【发布时间】:2016-08-15 11:42:47
【问题描述】:
我有一个使用 EclipseLink 和 SQL Server 的应用程序。
当我对 SQL Server 类型 Time 的列执行以下 JPQL 查询时:
VisitMasterTable.bookingTime between '08:00:00' and '08:59:00'
然后我得到以下错误:
数据类型
time和datetime在大于等于运算符中不兼容。
这是怎么引起的,我该如何解决?
【问题讨论】:
-
首先 - bookingTime 的列定义是什么?下一篇:为什么不用使用 PreparedStatement 而不是文字?
-
列定义
bookingTime time,我正在使用JPA -
您可以在此处包含您的查询吗?
-
JPQL查询
select VisitMasterTable from VisitMasterTable as VisitMasterTable where VisitMasterTable.bookingDate = '2016-08-15' and VisitMasterTable.bookingTime between '08:00:00' and '08:59:00' -
生成的 SQL `SELECT .... FROM VISITMASTERTABLE t0 WHERE ((t0.BOOKINGDATE = {d '2016-08-15'}) AND (t0.BOOKINGTIME在 {t '08:00:00'} 和 {t '08:59:00'}))`之间
标签: sql-server jpa time eclipselink