我正在使用 Hibernate,Spring Boot 和 Postgres。我有一个 time with time zone 列
和另一个 date
列。我尝试添加这两列以获取 timestamp with timezone value
。但是使用 hibernate 查询只返回 timestamp without time zone
。有什么办法可以达到同样的效果
我的查询是这样的
@Query(value = "select date_col + time_with_timestamp_column from myTable", nativeQuery = true)
时间戳 fetchvalue();
最佳答案
如果您使用的是 Spring Data,则可以通过 @Query(..., native=true)
使查询成为原生查询。这应该会导致查询作为实际 SQL 而不是 JPQL 执行,这可能会解决类型问题
关于postgresql - 在 hibernate 中获取具有时区值的 itimestamp,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51656525/