Hibernate 6 cannot persist Enum as Ordinal in VARCHAR column

Did you try with the latest Hibernate version 6.2.7.Final yet? If so, please create an issue in the issue tracker(https://hibernate.atlassian.net) with a test case(https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-6/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) that reproduces the issue.

The test template you linked looks like itā€™s about reading/writing data, and doesnā€™t seem to invoke the validator at all. Maybe it was not clear, but itā€™s the validator that fails.

Also something I discovered today: disabling the validator and then invoking normal reads/writes works fine (Java enums peristed into varchar columns). The problem seems to be isolated only in the hibernated validator.

If thereā€™s a test template for validating entities then I could try to implement a testā€¦

Are you sure the test case doesnā€™t use the validator @Kidlike? I was able to make a reproducer with the test case he linked to:

This worked in previous versions of Hibernate, it is only after updating that this stopped working.

Hereā€™s the issue report, accompanied with a test case: [HHH-17180] - Hibernate JIRA

1 Like

The test template you linked looks like itā€™s about reading/writing data, and doesnā€™t seem to invoke the validator at all. Maybe it was not clear, but itā€™s the validator that fails..
.