@Documented @Target(value=CONSTRUCTOR) @Retention(value=RUNTIME) public @interface QueryProjection
Example
class UserInfo {
private String firstName, lastName;
@QueryProjection
public UserInfo(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}
// getters and setters
}
The projection can then be used like this
QUser user = QUser.user;
List <UserInfo> result = querydsl.from(user)
.where(user.valid.eq(true))
.select(new QUserInfo(user.firstName, user.lastName))
.fetch();
Copyright © 2007–2016 Querydsl. All rights reserved.