运行此 java 代码时出现异常:
List<Tuple> companies2accLoginCount = accoutLoginCountQuery
.listDistinct(new QTuple(QCompany.company1.id, QAccountLogin.accountLogin.loginDatetime.dayOfMonth().countDistinct()));
例外:
java.lang.IllegalArgumentException: org.hibernate.hql.internal.ast.QuerySyntaxException: expecting CLOSE, found '(' near line 1, column 48 [select distinct company1.id, count(distinct day(accountLogin.loginDatetime))
from de.workxl.cxlbackend.database.model.Company company1
left join company1.accounts as account
left join account.accountLogins as accountLogin
where accountLogin.loginDatetime > ?1
group by company1.id
having count(distinct day(accountLogin.loginDatetime)) >= ?2]
与dayofyear相同。在 dayofyear 或 dayofmonth 之后,似乎除了左括号之外还有其他东西。
我正在使用 Hibernate 4.2.2 和 QueryDSL 2.9.0
更新:我刚刚设法将项目迁移到 QueryDSL 3.2.3(必须将 spring-data-commons 升级到 1.6.1 和 spring-data-jpa 到 1.4.1),但异常仍然存在。