I am working on migrating a legacy Hibernate project from version 4.1 to 5.4 . The code has Multilevel Joined table inheritance using a dedicated DiscriminatorColumn . The code was working fine in Hibernate 4 but throwing errors in Hibernate 5.
Could you also please test whether the problem persists with Hibernate 6.0? Either way, you can create a JIRA issue for this bug against the 5.6.8 version.
Finally, it’s resolved after removing all the @DiscriminatorColumn & @DiscriminatorValue annotations on all the classes. Looks like hibernate 5 is strict with the annotations. Now, the generated joined query for retrieving records is similar to Hibernate 4. It uses a special column named clazz using case statement to determine the inheritance type. This column will be used by hibernate internally.