Markus Hofstetter (
https://hibernate.atlassian.net/secure/ViewProfile.jspa?accountId=557058%...
) *commented* on HHH-15777 (
https://hibernate.atlassian.net/browse/HHH-15777?atlOrigin=eyJpIjoiMTBlZG...
)
Re: wrong column type expected for audit table keys (
https://hibernate.atlassian.net/browse/HHH-15777?atlOrigin=eyJpIjoiMTBlZG...
)
I also encountered this Problem. Envers ignores the @JdbcTypeCode Annotation.
I have a @MappedSuperclass that defines an id like this:
@Schema
@Id
// @Type(value = org.hibernate.type.UUIDCharType.class) // this was the way to do it in
hibernate 5
@JdbcTypeCode(SqlTypes.VARCHAR) // hibernate 6 way
@Column(nullable = false, updatable = false, length = DB_UUID_LENGTH)
@NonNull
private UUID id = UUID.randomUUID();
When exporting the schema through hibernate this creates the actual Entity Tables
correctly but envers tries to generate a binary column. The DB dialect I am using is
mariadb.
CREATE TABLE IndexPerson (
id VARCHAR(36) NOT NULL,
userErstellt_id VARCHAR(36) NOT NULL,
userMutiert_id VARCHAR(36),
name VARCHAR(255),
vorname VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
)
ENGINE = InnoDB;
CREATE TABLE IndexPerson_AUD (
id BINARY(36) NOT NULL,
userErstellt_id BINARY(36),
userMutiert_id BINARY(36),
name VARCHAR(255),
vorname VARCHAR(255),
PRIMARY KEY (REV, id)
)
ENGINE = InnoDB;
As you can see varchar(36) is used for the "real" entity table as requested.
However the audit Table is generated with a binary column which obviously will not work.
(
https://hibernate.atlassian.net/browse/HHH-15777#add-comment?atlOrigin=ey...
) Add Comment (
https://hibernate.atlassian.net/browse/HHH-15777#add-comment?atlOrigin=ey...
)
Get Jira notifications on your phone! Download the Jira Cloud app for Android (
https://play.google.com/store/apps/details?id=com.atlassian.android.jira....
) or iOS (
https://itunes.apple.com/app/apple-store/id1006972087?pt=696495&ct=Em...
) This message was sent by Atlassian Jira (v1001.0.0-SNAPSHOT#100231- sha1:2d13be9 )