我使用 PostgreSQL 作为数据库,我有一个 timestamptz 列 我想将其转换为给定的时区。
select
shipment0_.estimated_delivery_date_time at time zone 'IST'
from
shipment shipment0_
是查询, 如何使用 JPA 标准和时区作为用户输入来实现它。 我无法使用 native 查询或 JPQL,因为我已经有其他使用条件 API 的过滤器
最佳答案
根据这篇博文https://vladmihalcea.com/sql-functions-multiple-parameters-jpql-hibernate/
设法使用 MetadataBuilderContributor 注册自定义函数
关于postgresql - 带有条件生成器的 Spring JPA 将带有时区的时间戳转换为带有给定时区的本地时间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58563505/