开发者社区> 问答> 正文

hibernate hql 时间段查询 报错 ?报错

List orderList = getSession().createQuery("select o.client.name,sum(capital*1.0) from Order o where o.orderDate between "+
helper.getStartTime()+" and "+ helper.getEndTime() +" group by o.client.name")
.setFirstResult(page.getStartIndex())
.setMaxResults(page.getPageSize())
.list();

以上代码报错

org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: Jan near line 1, column 110 [select o.client.name,sum(capital*1.0) from com.brainstrong.crms.domain.Order o where o.orderDate between Mon Jan 01 00:00:00 CST 2007 and Tue Jan 01 00:00:00 CST 2008 group by o.client.name]

怎么解决,在线等。。。急!!!

展开
收起
爱吃鱼的程序员 2020-06-23 13:37:48 409 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    时间格式问题,你打印的Sql不能在数据库执行吧。

    http://blog.csdn.net/chen1218chen/article/details/51832691

    2020-06-23 13:38:06
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载