Hey,
hope i write this bug to the correct module/component.
We have a strange bug that if we use LocalDate, dates before 1-1-1940 are written down 1 day earlier, everything above works. We use this for a 'birthday'. in mysql it is type date.
What we found out: if we change the database mysql field to a datetime, and also change the Entity to LocalDateTime, and use "00:00:00 (startofDay) before writing to the database we see the following: -Everything after 1-1-1940 is written down as the correct date and time. The time is then 23:00 since database is UTC) and it is converted back correcly to "00:00". it is represented correctly. -all dates >= 1-1-1940 we see that "23:40" is in database. Since we choose startOf day the 40 minutes do not mind in this case.
However when using the LocalDate for birthday (there is no time then) i think somehow in the hibernate, jpa or mysql connector this issue causes a day shift on all dates < 1940.
So i think when using LocalDate if we choose “1920-02-08”, in datatabase “1920-02-07” is stored..
We use : spring boot release 2.2.1 (spring modules like jdbc: 5.2.1) spring jpa latest 2.2.4 mysql connector 8.0.18
Mysql database 5.7 |
|