Hinrik (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=70121%3...
) *commented* on HHH-11396 (
https://hibernate.atlassian.net/browse/HHH-11396?atlOrigin=eyJpIjoiNmRjYT...
)
Re: Conversion of Date to LocalDate does not consider timezone difference (
https://hibernate.atlassian.net/browse/HHH-11396?atlOrigin=eyJpIjoiNmRjYT...
)
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 (
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.
(
https://hibernate.atlassian.net/browse/HHH-11396#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-11396#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100207- sha1:c85b1ee )