Improved mapping of ZonedDateTime and OffsetDateTime in Hibernate 6

Thorben Janssen
Thorben Janssen
1.6 هزار بار بازدید - 2 سال پیش - Working with timestamps with timezone
Working with timestamps with timezone information has always been a struggle. Since Java 8 introduced the Date and Time API, the classes OffsetDateTime and ZonedDateTime have become the most obvious and commonly used types to model a timestamp with timezone information. And you might expect that choosing one of them should be the only thing you need to do.
But unfortunately, that isn’t the case if you want to persist this information in a relational database. Even though the SQL standard defines the column type TIMESTAMP_WITH_TIMEZONE, only a few databases support it. Due to that, the JPA specification doesn’t support OffsetDateTime and ZonedDateTime as attribute types. Hibernate 5 supports them by normalizing the timestamp and storing it without timezone information. Hibernate 6 improves on this and provides a clear and flexible mapping for these types.


Like my channel? Subscribe!
http://bit.ly/2cUsid8

Read the accompanying post: https://thorben-janssen.com/hibernate...

Want to connect with me?
Blog: https://thorben-janssen.com/
Twitter:  Twitter: thjanssen123
Facebook: Facebook: thorbenjanssenofficial
Linkedin: LinkedIn: thorbenjanssen
2 سال پیش در تاریخ 1401/03/12 منتشر شده است.
1,630 بـار بازدید شده
... بیشتر