Persist java.time.Instant (JDK8) with JPA2/Hibernate

Either use Hibernate 5.2.0+ or for earlier Hibernate 5 add the following dependency:

    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-java8</artifactId>
        <version>${hibernate.version}</version>
    </dependency>

In Hibernate 5.2 onwards has this issue solved more fully - you no longer need to include the hibernate-java8 dependency from Ipandzic's comment and you can use java.time.* classes such as LocalDateTime or Instant without any additional steps. You also do not need to mark columns using java.util.LocalDateTime etc as Temporal anymore, the way you had to with the older java.util.Date approach.

Since Hibernate 5.2, the hibernate-java8 content has been merged into hibernate-core see the change notes here


See the ThreeTen home page, where three different JPA libraries are mentioned:

  • Jadira user type
  • ThreeTen JPA
  • JPA attribute converters