Databases support various data types to store date and time information. The most commonly used ones are:
DATE to save a date without time information,
TIME to store a time without a date, and
TIMESTAMP to store date and time information.
You can map all of them with JPA and Hibernate.
But you need to decide to which Java type you want to map your database column. JPA supports most of them. In addition to that, Hibernate provides proprietary support for almost all of the remaining ones.
I will show you how to define the different mappings in this video.
Links mentioned:
JPA Tips: How to map a Duration attribute: https://thorben-janssen.com/jpa-tips-...
Hibernate Tips: What’s the best way to persist a ZonedDateTime: https://thorben-janssen.com/hibernate...
Like my channel? Subscribe!
➜ http://bit.ly/2cUsid8
Join the free Member Library:
https://goo.gl/dtyIIC
Read the accompanying post: https://thorben-janssen.com/hibernate...
Want to connect with me?
Blog: https://thorben-janssen.com/
Twitter: / thjanssen123
Facebook: / thoughtsonjava
#Hibernate #Date #Time