我正在尝试使用Querydsl
在.list
中选择特定列。我在.list()
public List<Account> btnSearchClick(String sclientacctid, String sacctdesc, String sinvestigatorname,
String sdeptname) {
QAccount account = QAccount.account;
QDepartment department = QDepartment.department;
QAccountCPCMapping accountCPCMapping = QAccountCPCMapping.accountCPCMapping;
QInvestigator investigator = QInvestigator.investigator;
@SuppressWarnings("rawtypes")
JPAQuery query = new JPAQuery(em);
query
.from(account)
.innerJoin(account.department, department)
.innerJoin(account.accountCPC, accountCPCMapping)
.innerJoin(account.investigator, investigator)
.where(account.ninstid.eq(60))
.list(account.sclientacctid , department.sdeptname, investigator.sinvestigatorname , accountCPCMapping.sccpcode);
.list()的错误消息
The method list(StringPath, StringPath, StringPath, StringPath) is undefined for the type QueryBase
任何人都可以告诉我为什么查询没有服用.list()?
答案 0 :(得分:0)
您使用的是哪个版本的querydsl? 如果4.x的主要方法不再可用。 尝试以这种方式修改您的代码:
QueryBase queryBase= new JPAQuery(em)....
FetchableQueryBase fetchable = (FetchableQueryBase) queryBase;
fetchable.fetch();
或降级到querydsl 3.x以使用list()。