Persisting Joda DateTime instead of Java Date in Hibernate

前端 未结 4 1764
一整个雨季
一整个雨季 2021-02-05 13:22

My entities currently contain java Date properties. I\'m starting to use Joda Time for date manipulation and calculations quite frequently. This means that I\'m constantly hav

4条回答
  •  梦毁少年i
    2021-02-05 13:52

    I think using the Joda DateTime as your bean property type is probably a good idea. You can then have Hibernate do the conversion and save the property as the native database date format.

    I have personally used jodatime-hibernate and have not had a problem with it (we're using Hibernate 3.2.5GA).

    If you have concerns about jodatime-hibernate, you can always use Hibernate's custom type mapping mechanism (which I'm sure is all jodatime-hibernate does).

提交回复
热议问题