QueryDSL(JPA)dayOfYear,dayOfMonth翻译为休眠 [英] QueryDSL (JPA) dayOfYear, dayOfMonth translation to hibernate
问题描述
列表< Tuple> companies2accLoginCount = accoutLoginCountQuery
.listDistinct(new QTuple(QCompany.company1.id,QAccountLogin.accountLogin.loginDatetime.dayOfMonth()。countDistinct()));
例外:
java.lang.IllegalArgumentException:org.hibernate.hql.internal.ast.QuerySyntaxException:期望CLOSE,找到'('在第1行第48列[选择distinct company1.id,count(distinct day(accountLogin .loginDatetime))
from de.workxl.cxlbackend.database.model.Company company1
left join company1.accounts as account $ b $ left left join account.accountLogins as accountLogin $ b $ where where accountLogin。 loginDatetime>?1
group by company1.id
have count(distinct day(accountLogin.loginDatetime))> =?2]
与 dayofyear 相同。在一天或一天的月份之后,似乎预计会有其他的左括号。
我使用Hibernate 4.2.2和QueryDSL 2.9.0
更新:我刚刚设法迁移QueryDSL 3.2.3项目(必须将spring-data-commons升级到1.6.1,并将spring-data-jpa升级到1.4.1 ),但异常仍然存在。
这似乎是Hibernate解析器中的一个错误。这适用于EclipseLink。
I'm getting an exception when running this java code:
List<Tuple> companies2accLoginCount = accoutLoginCountQuery
.listDistinct(new QTuple(QCompany.company1.id, QAccountLogin.accountLogin.loginDatetime.dayOfMonth().countDistinct()));
The exception:
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]
The same with dayofyear. It seems something else than a left bracket is expected after dayofyear or dayofmonth.
I'm using Hibernate 4.2.2 and QueryDSL 2.9.0
update: I've just managed to migrate the project to QueryDSL 3.2.3 (had to upgrade spring-data-commons to 1.6.1 and spring-data-jpa to 1.4.1 as well) but the exception persists.
This seems to be a bug in Hibernate's parser. This works with EclipseLink.
这篇关于QueryDSL(JPA)dayOfYear,dayOfMonth翻译为休眠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!