Spring data query for localdate returns wrong entries - minus one day

前端 未结 1 1152
梦谈多话
梦谈多话 2020-12-22 12:21

In my Entity i have a field of type LocalDate "day" in MySQL it is mapped to "date" type.

MySQL seems to run on UTC SELECT

相关标签:
1条回答
  • 2020-12-22 12:57

    There was a bug in the MySQL Connector/J earlier than version 8.0.22. Updating to 8.0.22 will fix the issue.

    From the 8.0.22 changelog:

    LocalDate, LocalDateTime, and LocalTime values set through Connector/J were altered when there was a timezone difference between the server and the client. This fix corrects the issue by handling the LocalDate, LocalTime, and LocalDateTime with no time zone conversion and no intermediate conversions to other date-time classes.

    The underlying bug: https://bugs.mysql.com/bug.php?id=93444

    0 讨论(0)
提交回复
热议问题