


You can then use these attributes in the same way as any other attributes in your Java code. Private Long LocalDate LocalDateTime Duration duration class MyEntity = "id", updatable = false, nullable = false) You can see an example of an entity with attributes of type LocalDate, LocalDateTime, and Durationin the following code snippet. Hibernate gets all required information from the type of the attribute.

Not even the which you currently add to each attribute. This provides the main advantage, that you don’t have to provide any additional annotations. Hibernate supports the classes of the date and time API as BasicTypes. Java typeĭate and Time API Classes as Entity Attributes The following table shows an overview of the supported classes and their JDBC mapping. Hibernate maps the classes of the date and time API to the corresponding JDBC types. If you are using Hibernate as part of Wildfly 10, you don’t have to do anything because the Hibernate module already contains the required jar file. The Java 8 support is shipped in a separate jar file called hibernate-java8.jar, which you need to add to the classpath of your application. One of the features added to Hibernate 5 is the support of Java 8 classes like the date and time API. This approach is not portable to other JPA implementations but much easier to use as I will show you in the video below.
