@Enumerated ignored when in an @Embeddable entity

Description

When using an @Enumerated(EnumType.STRING) annotation on an embeddable entity property, it is ignored by the orm which saves the enum ordinal value instead of it's string value

Workaround:
Moving the @Enumerated(EnumType.STRING) from the property to the getter makes the unit test succeed

Unit test available on github to demonstrate the bug:
https://github.com/edeoliveira/hibernate-demo/blob/master/src/test/java/org/edeoliveira/hibernate/bugs/embedded/NestedEmbeddedEnumBugTest.java

Activity

Show:

Details

Assignee

Reporter

Labels

Components

Priority

Created October 28, 2020 at 9:58 PM
Updated October 30, 2020 at 12:22 PM