gpt4 book ai didi

java - org.hibernate.hql.internal.ast.QuerySyntaxException : unexpected token: group near line 1

转载 作者:行者123 更新时间:2023-12-02 12:11:45 25 4
gpt4 key购买 nike

我在执行查询时遇到错误。错误是:

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: GROUP near line 1, column 239 [SELECT j.orderDate, MAX(j.endTime), MIN(j.startTime) FROM fr.thelem.timesbatch.dao.entities.JobExecEntity j WHERE j.name=?0 AND TO_DATE(j.orderDate,'YYYYMMDD')>?1 AND TO_DATE(j.orderDate,'YYYYMMDD')

查询是:

Query query = this.em.createQuery(
"SELECT j.orderDate, MAX(j.endTime), MIN(j.startTime) "
+ "FROM JobExecEntity j "
+ "WHERE j.name=?0 "
+ "AND TO_DATE(j.orderDate,'YYYYMMDD')>?1 "
+ "AND TO_DATE(j.orderDate,'YYYYMMDD')<?2 "
+ "AND NOT j.id=0 ORDER BY j.startTime "
+ "GROUP BY j.orderDate")
.setParameter(0, nomChaine)
.setParameter(1, new Date(Long.parseLong(start)*1000))
.setParameter(2, new Date(Long.parseLong(end)*1000));

有什么想法吗?

最佳答案

ORDER BY j.startTime 子句应位于 GROUP BY j.orderDate 子句之后。

关于java - org.hibernate.hql.internal.ast.QuerySyntaxException : unexpected token: group near line 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46489863/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com