Persist LocalDateTime, ZonedDateTime & Co with Hibernate

Persist LocalDateTime, ZonedDateTime & Co with Hibernate

The Date and Time API, introduced in Java 8, finally replaced the old java.util.Date. It’s much easier to use and finally offers separate classes representing date, date with time, and only time information. That not only improves your business code but also makes it easier to use them as entity attributes. At least if you’re…

Hibernate Tips: What’s the best way to persist a ZonedDateTime

Hibernate Tips: What’s the best way to persist a ZonedDateTime

Hibernate Tips is a series of posts in which I describe a quick and easy solution for common Hibernate questions. If you have a question for a future Hibernate Tip, please leave a comment below. Question: During last week’s Hibernate workshop, I got a few questions about Hibernate’s handling of ZonedDateTime objects. To sum them…