AI Briefing
KO

Hibernate's Time Runs Backwards

·2024.10.16 10:00

Key point

Analyzed and resolved a login error caused by a nanosecond-handling bug in Hibernate that occurred during a Spring Boot 3.x upgrade.

Details

After the Delivery Product development team upgraded to Spring Boot 3.x to address AWS MSK, some delivery managers began experiencing app login failures. Analysis of the error logs revealed a java.time.DateTimeException, which was identified as being caused by a negative nanosecond value during conversion when querying the DB.

The root cause was that when Hibernate was upgraded from 5.6.5 to 6.5.5, saving a LocalTime to the DB began including nanosecond information. Previous versions ignored nanoseconds, but the latest version reflects nanoseconds when creating Time objects. In particular, the issue was reproduced in the KST (UTC+9) timezone, during the 00:00–08:00 range, when a nanosecond value with 3 decimal digits existed, causing an internal calculation error that generated a negative nanosecond value.

This bug occurs in the logic of the LocalTimeJavaType.unwrap method inside the Hibernate library, and was fixed in GitHub PR #8328, but had not been released at the time. The development team resolved the issue by applying an AttributeConverter that strips nanoseconds when saving and querying LocalTime objects. This case illustrates the importance of debugging and test coverage during major version upgrades.

This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.

Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.