java.time.LocalDate persisted to MySQL as 1 day less after Mar 12, 2017

Description

I have a production application using Spring JPA + Hibernate + MySQL.

On Feb 13th, with no code or library changes it started saving java.time.LocalDate as 1 day less.

For example LocalDate.of(2017, 3, 12) or older saves to MySQL correctly.
However, LocalDate.of(2017, 3, 13) saves to MySQL as 2017-03-12,
and LocalDate.of(2017, 3, 14) saves to MySQL as 2017-03-13, etc...

I created a test application to verify and demonstrate.
It test saves a LocalDate and a unique integer (month * 100 + day) for each day in March.
Up to the 12th works correctly, afterwards it saves each day as 1 day less.

Here is a dump of the MySQL table after the test completes:
2017-03-01 301
2017-03-02 302
2017-03-03 303
2017-03-04 304
2017-03-05 305
2017-03-06 306
2017-03-07 307
2017-03-08 308
2017-03-09 309
2017-03-10 310
2017-03-11 311
2017-03-12 313
2017-03-13 314
2017-03-14 315
2017-03-15 316
2017-03-16 317
2017-03-17 318
2017-03-18 319
2017-03-19 320
2017-03-20 321
2017-03-21 322
2017-03-22 323
2017-03-23 324
2017-03-24 325
2017-03-25 326
2017-03-26 327
2017-03-27 328
2017-03-28 329
2017-03-29 330
2017-03-30 331

Demo attached.

Environment

None

Activity

Show:
Peter McGill
March 21, 2017, 6:56 PM

Further testing has revealed while the bug affects Hibernate, it's not caused by Hibernate.

If I run the tests on H2 instead of MySQL they pass.

If I bypass Spring JPA + Hibernate and use pure JDBC with MySQL the bug occurs.

Indicating the Bug is actually in MySQL Connector / J, not Hibernate.

Reported to MySQL as: https://bugs.mysql.com/bug.php?id=85570

Assignee

Unassigned

Reporter

Peter McGill

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure