DST is ignored when saving a LocalTime with hibernate.jdbc.time_zone=UTC

Description

Hello everybody,
When I want to store LocalTime and OffsetTime into a Time column with the hibernate.jdbc.time_zone set on "UTC" the value is not correctly handle if we are on a Daylight Saving Time period.

Consider this entity :

Add this in your configuration :

Add a new row with a local Time at 12:00pm

The value expected is: 10:00am
The actual value is: 11:00am

Change with Instant object and Timestamp column make it working as expected and the value stored is "My time minus 2 hours". Because we are on a DST period, the transformation for LocalTime into UTC values are not handle properly and the DST is ignored.

We can reproduced this with both LocalTime and OffsetTime objects.
I have a full test case from Hibernate templates here : https://github.com/avdev4j/hibernate_utc_localTime

Just launch the storeLocalTimeShouldReturnWithAnUtcValue() unit test.

Hope it can help to improve this option because it's very usefull.
If you need more informations please tell me .

Environment

hibernate -> 5.3.6.Final
h2database -> 1.3.176
junit -> 4.12

Status

Assignee

Unassigned

Reporter

Anthony Viard

Fix versions

None

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure