Does Hibernate 6.x maintain UTC consistency for java.time.Instant across varying database session timezones?
0 reputation · 11 Jan 2026, 19:22 UTC
When using Hibernate 6.x to persist java.time.Instant values into TIMESTAMP columns, the framework typically stores the value as UTC. However, the interpretation of these values during retrieval often depends on the underlying database's session timezone and the specific JDBC driver implementation.
There is uncertainty regarding whether Hibernate provides a mechanism to ensure that the retrieved Instant remains identical to the persisted UTC value, regardless of the regional timezone configured at the database server or session level. This is particularly critical when moving data between MySQL and PostgreSQL, as they handle timestamp conversions differently.
- Does Hibernate 6.x automatically normalize the session timezone to UTC when mapping
Instantfields? - Which configuration settings are required to prevent the JDBC driver from applying local timezone offsets during the retrieval of
TIMESTAMPcolumns?