数据类型时间和日期时间在大于或等于运算符中不兼容
The data types time and datetime are incompatible in the greater than or equal to operator
我有一个使用 EclipseLink 和 SQL 服务器的应用程序。
当我在 SQL 服务器类型 Time
的列上执行以下 JPQL 查询时:
VisitMasterTable.bookingTime between '08:00:00' and '08:59:00'
然后我得到以下错误:
The data types time
and datetime
are incompatible in the greater than or equal to operator.
这是怎么造成的,我该如何解决?
您需要将 sendTimeAsDateTime=false
添加到您的连接字符串中,例如:
jdbc:sqlserver://localhost:1433;databaseName=<db_name>;sendTimeAsDateTime=false
我有一个使用 EclipseLink 和 SQL 服务器的应用程序。
当我在 SQL 服务器类型 Time
的列上执行以下 JPQL 查询时:
VisitMasterTable.bookingTime between '08:00:00' and '08:59:00'
然后我得到以下错误:
The data types
time
anddatetime
are incompatible in the greater than or equal to operator.
这是怎么造成的,我该如何解决?
您需要将 sendTimeAsDateTime=false
添加到您的连接字符串中,例如:
jdbc:sqlserver://localhost:1433;databaseName=<db_name>;sendTimeAsDateTime=false