java - 时区映射到 LocalDateTime 而不是 OffsetDateTime 的时间戳

标签 java postgresql jooq java-time

jooq 3.9 中新的 Java 时间功能似乎映射了 postgresql 的 timestamp with time zoneLocalDateTime而我期望 OffsetDateTime.

这是预期的吗?


示例:我有一个像这样的 postgres 表:

CREATE TABLE so_table (
  id serial PRIMARY KEY,
  ts timestamp with time zone
);

我包括<javaTimeTypes>true</javaTimeTypes>在我的 pom 中,生成的类包含此方法:

public LocalDateTime getTs() {
    return (LocalDateTime) get(1);
}

最佳答案

Is that expected?

是和否。不幸的是,在版本 3.9 中,代码生成器中尚未包含 TIMESTAMP WITH TIME ZONE 数据类型支持:https://github.com/jOOQ/jOOQ/issues/5734

关于java - 时区映射到 LocalDateTime 而不是 OffsetDateTime 的时间戳,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41445767/

相关文章:

java - 泛型类型的编译时错误

java - Android-我可以自定义启动应用程序吗?

java - 从字符串中提取浮点值

ruby-on-rails - Rails 4 - has_one - 无法访问相关模型的属性

postgresql - Postgres ts_rank_cd : No function matches the given name and argument type

java - 在这种情况下如何使用jOOQ(或其他东西)

java - 组织.hibernate.HibernateException : More than one row with the given identifier was found

json - json 数组元素的总和和百分比

java - Jooq Maven 代码生成 : Cannot find symbol

maven - jooq-codegen-maven 插件和 JDK9 编译错误