【问题标题】:QueryDSL (JPA) dayOfYear, dayOfMonth translation to hibernateQueryDSL (JPA) dayOfYear, dayOfMonth 翻译成休眠
【发布时间】:2013-09-24 14:36:49
【问题描述】:

运行此 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 作为好)但异常仍然存在。

【问题讨论】:

  • 您尝试过更新版本的 Querydsl 吗?

标签: hibernate jpa querydsl


【解决方案1】:

这似乎是 Hibernate 解析器中的一个错误。这适用于 EclipseLink。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-01-19
    • 2013-06-19
    • 2011-06-25
    • 1970-01-01
    • 2021-06-25
    • 2012-04-19
    • 2013-01-29
    相关资源
    最近更新 更多