Uploaded image for project: 'Hibernate ORM'
  1. HHH-8844

Add support for Java 8 date and time types (JSR-310)

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: None
    • Fix versions: 5.0.0.Beta1
    • Components: hibernate-core
    • Labels:
    • Last commented by a user?:
      true
    • Sprint:

      Description

      Implement support for the new Java 8 temporal Java types (JSR 310).

      The initial implementation defines the following Types:

      • org.hibernate.type.DurationType - Maps a java.time.Duration to a SQL BIGINT (Long) representing the duration-in-nanoseconds.
      • org.hibernate.type.InstantType - Maps a java.time.Instant to a SQL TIMESTAMP
      • org.hibernate.type.LocalDateTimeType - Maps a java.time.LocalDateTime to a SQL TIMESTAMP
      • org.hibernate.type.LocalDateType - Maps a java.time.LocalDate to a SQL DATE
      • org.hibernate.type.LocalTimeType - Maps a java.time.LocalTime to a SQL TIME
      • org.hibernate.type.OffsetDateTimeType - Maps a java.time.OffsetDateTime to a SQL TIMESTAMP
      • org.hibernate.type.OffsetTimeType - Maps a java.time.OffsetTime to a SQL TIME
      • org.hibernate.type.ZonedDateTimeType - Maps a java.time.ZonedDateTime to a SQL TIMESTAMP

      As this relies on Java 8 and Hibernate still maintains compatibility back to Java 6, a new module hibernate-java8 was added to isolate the Java 8 compatibility to just these classes. We will fold the classes from this module into hibernate-core once we baseline one Java 8.


      Original request

      It would be cool to be able to persist the date time types newly introduced in Java 8 in a reasonable way. Currently the values are persisted as blobs effectively.

      There are already a user type implementations for the backport project of JSR-310 but they unfortunately don't work with the types from the java.time package. The support has also been requested in the user forums.

        Attachments

          Issue links

            Activity

              People

              • Votes:
                66 Vote for this issue
                Watchers:
                60 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - Not Specified
                  Not Specified
                  Logged:
                  Time Spent - 9.75h
                  9.75h