-
Notifications
You must be signed in to change notification settings - Fork 6
JDBC 4.2
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
on2017-03-26T02:00
the clocks forward to2017-03-26T03:00
witch means that2017-03-26T02:10
never exists.java.sql.Timestamp
is bound to the JVM time zone therefore if your JVM default time zone isEurope/Berlin
nojava.sql.Timestamp
for2017-03-26T02:10
can be created. If you're creating ajava.time.LocalDateTime
instance through ajava.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.