Joda time DateTime incorrectly stores in database

前端 未结 7 1809
青春惊慌失措
青春惊慌失措 2020-12-30 08:18

I\'m storing JodaTime DateTime field to timestamptz column by using org.jadira.usertype:usertype.jodatime:1.9. App server has +4 time

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 08:54

    Ok. I have spend 8 hours to solve the problem. If your are using usertype project to persist JodaTime, you have to set databaseZone property of PersistentDateTime class equals to current application server timezone (not database!).

    But it's better to use official hibernate support. It solves the problem out of the box because it uses java.utl.Date to persist DateTime and java.util.Date correctly persisted by default

提交回复
热议问题