You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While upgrading a Spring Boot app from v2.7.5 to v3.0.0, I upgraded the spring-data-envers starter to v3.0.0. The relevant section of the Gradle dependency report is shown at the end of this issue.
In my entity classes, the primary keys are UUIDs. The column type for these keys are varachar(255). Prior to the upgrade, these were defined as follows
In Hibernate 6, the type attribute of the @Type annotation no longer exists. Initially, I tried just removing this annotation, but this caused an error because Hibernate then expects the primary key column type to be a UUID. In order to inform Hibernate that it should be stored as a varchar, I added the @JdbcType annotation
While this fixes the mapping for the foo table, I now get a mapping error for the foo_aud.id column at startup.
Caused by: org.hibernate.tool.schema.spi.SchemaManagementException: Schema-validation: wrong column type encountered in column [id] in table [foo_aud]; found [varchar (Types#VARCHAR)], but expecting [uuid (Types#UUID)]
at org.hibernate.tool.schema.internal.AbstractSchemaValidator.validateColumnType(AbstractSchemaValidator.java:179) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
It seems that Hibernate/JPA is aware of the @JdbcType annotation when computing the expected column type, but Envers is not.
donalmurtagh
changed the title
spring-data-envers 3.0.0 expects the wrong type for audit table keys
spring-data-envers 3.0.0 expects the wrong column type for audit table keys
Nov 28, 2022
While upgrading a Spring Boot app from v2.7.5 to v3.0.0, I upgraded the spring-data-envers starter to v3.0.0. The relevant section of the Gradle dependency report is shown at the end of this issue.
In my entity classes, the primary keys are UUIDs. The column type for these keys are
varachar(255)
. Prior to the upgrade, these were defined as followsIn Hibernate 6, the
type
attribute of the@Type
annotation no longer exists. Initially, I tried just removing this annotation, but this caused an error because Hibernate then expects the primary key column type to be a UUID. In order to inform Hibernate that it should be stored as avarchar
, I added the@JdbcType
annotationWhile this fixes the mapping for the
foo
table, I now get a mapping error for thefoo_aud.id
column at startup.It seems that Hibernate/JPA is aware of the
@JdbcType
annotation when computing the expected column type, but Envers is not.Post-Migration Gradle Dependency Report
The text was updated successfully, but these errors were encountered: