Skip to content
Philippe Marschall edited this page Apr 24, 2018 · 13 revisions

If your driver supports JDBC 4.2 and you use Hibernate we strongly recommend using the UserTypes from the threeten-jpa-jdbc42-hibernate subproject instead of the ones from the threeten-jpa subproject for the following reasons:

  • Nano second resolution or the best resolution your database offers is supported for java.time.LocalTime.
  • Issues with timestamps not representable with the local time zone can be avoided. For example if you live in the time zone Europe/Berlin on 2017-03-26T02:00 the clocks forward to 2017-03-26T03:00 witch means that 2017-03-26T02:10 never exists. java.sql.Timestamp is bound to the JVM time zone therefore if your JVM default time zone is Europe/Berlin no java.sql.Timestamp for 2017-03-26T02:10 can be created. If you're creating a java.time.LocalDateTime instance through a java.sql.Timestamp instance that limitation carries over.

Note that we advise against storing non-UTC timestamps in TIMESTAMP [ WITHOUT TIME ZONE ] columns due to issues around silent data truncation when switching from summer to winter time.

Clone this wiki locally