When an audited column uses a columnDefinition, schema validation may fail.

Description

As mentioned on SO https://stackoverflow.com/questions/60931264/hibernate-envers-org-hibernate-tool-schema-spi-schemamanagementexception-schem, the following exception:

occurs for an entity using the following mapping:

The entity database model is currently:

This appears it could be related to https://hibernate.atlassian.net/browse/HHH-10844.

Environment

None

Activity

Show:
Chris Cranford
April 1, 2020, 8:32 PM
Edited

After investigation, I'm inclined to think the best course of action here might be to revert HHH-10844.

The changes introduced by was an attempt to resolve a column's Type back to a SQL Type. For cases where the mapping between Java and SQL types were 1:1, this seemed to work fine but in cases where the types ultimately differed in the case presented above, this resolved in a situation where the audit table's resolved type was incorrect.

One idea that might work here would be to introduce a ColumnDefinitionResolver contract that would know how to reliably extract the appropriate bits from the columnDefinition that is dialect-specific. This contract could also be extended by the user allowing them full control over the resolution in situations where the default behavior was limiting or prohibitive; tho I'm inclined for the time being to merely revert as discussed above.

Assignee

Chris Cranford

Reporter

Chris Cranford

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.4.10

Components

Affects versions

Priority

Major
Configure