@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 = query.from(user)
.where(user.valid.eq(true))
.list(new QUserInfo(user.firstName, user.lastName));
Copyright © 2007–2015 Mysema Ltd. All rights reserved.