【问题标题】:hibernate 4 and joda-LocalDate and persist it as SQL Datehibernate 4 和 joda-LocalDate 并将其保存为 SQL Date
【发布时间】:2014-03-19 20:29:37
【问题描述】:

这个link 几乎是我要找的,但是它将我的oracle db 上的LocalDate 持久化为Raw(255),所以我的问题是如何将joda LocalDate 持久化为sql 日期?

【问题讨论】:

  • 您确定要保留LocalDate 吗?它不包含时区信息...
  • 是的,比如生日字段。

标签: java hibernate jodatime


【解决方案1】:

好的,最后。

就我而言,如果我使用 org.jadira.usertype。不知何故,它在 oracle 上将 localdate 保留为 raw(255)。

    <dependency>
        <groupId>org.jadira.usertype</groupId>
        <artifactId>usertype.core</artifactId>
        <version>3.1.0.CR10</version>
    </dependency>

所以如果我将它更改为 joda-time-hibernate,它现在似乎工作正常,它作为 sql 日期持续存在。

    <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time-hibernate</artifactId>
        <version>1.3</version>
    </dependency>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-06-07
    • 1970-01-01
    • 2015-05-23
    • 2016-10-13
    • 2011-08-01
    • 2011-02-02
    • 2014-07-12
    相关资源
    最近更新 更多