lm121342074
lm121342074
采纳率7.1%
2017-03-31 01:28 阅读 854

获取时间段内的数据hql语句报错,怎么回事,求解答!!!

2017-3-28 15:24:21

Tue Mar 14 00:00:00 CST 2017

from AySupervise a where a.hostDate between Tue Mar 14 00:00:00 CST 2017 and Sat Mar 18 00:00:00 CST 2017 and a.personId = ? order by a.hostDate desc

第一个是hostDate时间日期格式,第二个是从页面获取到的字符串时间,我自己转化成日期格式,第三个是hql语句,下面是报的错
org.springframework.orm.hibernate3.HibernateQueryException: unexpected token: Mar near line 1, column 77 [from com.sysway.supervise.entity.AySupervise a where a.hostDate between Tue Mar 14 00:00:00 CST 2017 and Sat Mar 18 00:00:00 CST 2017 and a.personId = ? order by a.hostDate desc ]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: unexpected token: Mar near line 1, column 77 [from com.sysway.supervise.entity.AySupervise a where a.hostDate between Tue Mar 14 00:00:00 CST 2017 and Sat Mar 18 00:00:00 CST 2017 and a.personId = ? order by a.hostDate desc ]

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • yiyijianxian 我是1只猫 2017-03-31 02:06

    你数据库的时间字段是时间格式还是字符串格式,还有你的时间格式引的是java util 还是sql的?

    点赞 评论 复制链接分享

相关推荐