Fixed
Details
Assignee
Steve EbersoleSteve EbersoleReporter
Steve EbersoleSteve Ebersole
Details
Details
Assignee
Steve Ebersole
Steve EbersoleReporter
Steve Ebersole
Steve EbersoleCreated December 12, 2023 at 5:01 PM
Updated March 20, 2024 at 10:09 PM
Resolved February 26, 2024 at 3:57 PM
Java Time is a better way to handle date/time information introduced in Java 8. However, Hibernate still uses
java.util.Date
(and variants) for handling values at the vm/jdbc boundary. We should switch this to use the Java Time variants.Although JDBC did not add explicit methods for handling Java Time values, the spec did explicitly add them as allowable for getObject and setObject calls and requires drivers support them.
There are a few “layers“ to this which we can address iteratively -
Create
JdbcType
variants for each Java Time contract (LocalDateJdbcType
, …) with correspondingSqlTypes
entries (LOCAL_DATE
, …). These would use the JDBC get/setObject calls.Allow global opt-in to using these Java Time variants at the boundary.
Change the corresponding
JavaType
implementations to use the new matchingSqlTypes
code for theirJavaType#getRecommendedJdbcType
when enabled globally.This includes -
new
JdbcType
implsnew
SqlTypes
constantsnew flag
hibernate.type.prefer_java_type_jdbc_types
(seeorg.hibernate.cfg.MappingSettings#PREFER_JAVA_TYPE_JDBC_TYPES
)