相关疑难解决方法(0)

迁移到 SpringBoot 3:使用 oracle 驱动程序截断日期不再有效(休眠)

我目前正在将 SpringBoot 2.7 应用程序迁移到 SpringBoot 3。在 SpringData 存储库中使用以下查询:

\n
\n@Query("select b from #{#entityName} b where (trunc(b.date) <= trunc(:date))")\nList<T> findByDate(LocalDateTime date);\n\n
Run Code Online (Sandbox Code Playgroud)\n

虽然这在 SpringBoot 2.7 中效果很好,但在 SpringBoot 3 中会抛出以下消息:

\n
\n

org.hibernate.QueryException:函数 trunc() 的参数 1 的类型为 NUMERIC,但参数的类型为 java.time.LocalDateTime

\n
\n

不幸的是,简单迁移到 datetrunc 并不成功:

\n
\n

错误消息 = ORA-00904: "DATETRUNC": ung\xc3\xbcltige ID

\n
\n

有人有解决方案吗?

\n

此致

\n

oracle spring hibernate spring-data spring-boot

9
推荐指数
2
解决办法
6423
查看次数

标签 统计

hibernate ×1

oracle ×1

spring ×1

spring-boot ×1

spring-data ×1