我正在尝试在查询中使用ConstructorExpression.create(RoleDto.class, role.id, BooleanTemplate.FALSE)
。它抛出wrong number of arguments
例外。
查询:
JPAQuery roleQuery = new JPAQuery(em);
List<RoleDto> tupples = roleQuery
.from(role)
.where(role.techSupport.isFalse())
.distinct()
.list(ConstructorExpression.create(RoleDto.class, role.id, BooleanTemplate.FALSE));
RoleDto类:
public class RoleDto {
private String roleId;
private boolean bpmRole = false;
public RoleDto(Long roleId, Boolean bpmRole) {
this.roleId = roleId+"";
this.bpmRole = bpmRole.booleanValue();
}
public String getRoleId() {
return roleId;
}
}
此外,还有一个很容易将role.id从long转换为string。