Details
Assignee
Chris CranfordChris CranfordReporter
Anver BogatovAnver BogatovLabels
Components
Affects versions
Priority
Major
Details
Details
Assignee
Chris Cranford
Chris CranfordReporter
Anver Bogatov
Anver BogatovLabels
Components
Affects versions
Priority
Created September 27, 2023 at 9:22 AM
Updated September 27, 2023 at 9:22 AM
Problem description:
In Hibernate 5 → 6 migration guide (https://github.com/hibernate/hibernate-orm/blob/6.0/migration-guide.adoc#instant-mapping-changes)
hibernate.type.preferred_instant_jdbc_type
property is described. For backward compatibility it is recommended to set it toTIMESTAMPT
. In that case the property forces Hibernate 6 to use specifiedTIMESTAMP
to representjava.time.Instant
type. Everything works fine for hibernate entities, but it does not work for Envers.Envers forces fields of
java.time.Instant
type to be mapped onTIMESTAMPT_UTC
, no matter if you have set the property as described.How to reproduce:
To reproduce the issue, it is enough to add following-like field to test entity:
set property described above:
and configure logging of SQL queries with parameters bound:
In that case, after new entity is created following like information can be see in logs for entity’s table:
and following like information cab be seen for audit table:
Workaround:
It is possible to workaround the issue by implementing own
org.hibernate.usertype.UserType
forjava.time.Instant
type with mapping it toTIMESTAMPT
.