Hibernate 6.2.2 TimeZone issue with OffsetTime on MySql Time field

57 Views Asked by At

I had a Backend (upgraded from SpringBoot 2) on Spring Boot 3.0.13 with Hibernate 6.1.7.Final Spring 6.0.14 Everything waas fine with DateTime, OffsetTime, ZoneDateTime, + Timezone (application.yml property hibernate.jdbc.time_zone: UTC)

When I upgraded to Spring Boot 3.1.0 with Hibernate 6.2.2.Final Spring 6, my OffsetTime is not saved correctly in database and Timezone "serialization" is not correct.

@Column(name = "offset_time")
private OffsetTime offsetTime;

Database is MySql 8.0.32 and offset_time column is "Time" type.

  • offsetTime variable is "14:30Z" before saving
  • SELECT value time from database is "1970-01-01T13:30:00.000+0100"

So offsetTime is saved as if UTC is not considered with -1h and set in database with +1h keeping system default instead of stay in UTC. It seems to be an Hibernate 6.2.2 issue but I would like to knwo if there is a way to fix it.

0

There are 0 best solutions below