columnDefinition broken for audit mappings

Description

should be fixed with version 5.4.11, but now a column definition like

@Column(name = "text", columnDefinition = "mediumtext")
private String text;

or

@Column(name = "foo", columnDefinition = "char(40)")
private String foo;

no longer works with envers. It will result in the following log messages

> Column [text] uses a column-definition of [mediumtext], resolved sql-type as [varchar(255)].
> Column [foo] uses a column-definition of [char(40)], resolved sql-type as [varchar(255)].

and exceptions like this:

> Schema-validation: wrong column type encountered in column [foo] in table [bar]; found [char (Types#CHAR)], but expecting [varchar(255) (Types#VARCHAR)]

I think this behaviour was added by this commit: https://github.com/hibernate/hibernate-orm/commit/38f01311602f115ccec23f9ee8faf4b2d69d636d

Environment

None

Activity

Show:
Chris Cranford
April 1, 2020, 8:54 PM

As I mentioned in HHH-13922, I believe the best course of action for now is to revert HHH-10844. By doing the revert, the audit tables will once again have their sql-type based specifically on the sql-type from the base table. For the situations mentioned in this issue, things will "just work".

Daniel Kellenberger
March 4, 2020, 5:51 AM

The same applies with custom domain objects. Example:

And it generates varchar(255) instead of cs_key

This results in the application not been able to start anymore:

Schema-validation: wrong column type encountered in column [configuration_group_key] in table [configuration_group_aud]; found [cs_key (Types#DISTINCT)], but expecting [varchar(255) (Types#VARCHAR)]

Fixed

Assignee

Chris Cranford

Reporter

JiraAccount

Fix versions