I'm a bit late to the party but this might help someone. I had the same issue with MySQL 8 running in a testcontainer which seemed to using the Europe/Zurich zone of my machine, while my application which connects to the DB explicitly uses UTC. I persist a LocalDate but receive the value of the previous day if I subsequently load it from the DB. Adding serverTimezone, hibernate.jdbc.time_zone, or "SET GLOBAL time_zone" did not help. In the end, the solution described here worked: https://forum.jmix.io/t/localdate-mysql-issue-wrong-day-persisted/1090, namely to include "cacheDefaultTimeZone=false" in the JDBC connection string. No other configuration needed. |