The workaround is to not use a type variable for persistent attribute types. If you think about the concept of attributes and which type declares them from a JPA model perspective, the use of type variables is complicating a lot. Let me explain what happens here. For the JPA metamodel in Hibernate 6 there is only one attribute TaskServiceDocument#taskSubStage which has the type Enum. It doesn’t matter in the JPA metamodel what you provide as type argument in subtypes. Since TaskServiceDocument declares the attribute, we have to consider the type that is declared there. In previous versions of Hibernate the type of that attribute was actually an (arbitrary) one of the possible type arguments as provided through subtypes of TaskServiceDocument. This is obviously wrong. If you ask for the type of the TaskServiceDocument#taskSubStage attribute it must be Enum. We went to great lengths to ensure support for type variables is relatively decent, but we obviously have some edge cases that haven’t been covered by the testsuite. You’ll just have to wait for the fix to be merged and released, or you build your own version in the meantime to continue testing. |