An exception is thrown when querying for entities with Envers where an association is traversed and the target entity is mapped with inheritance strategy 'joined subclass'. This issue only occurs when using AuditStrategy 'ValidityAuditStrategy'. Consider the following example:
The problem is that the REVEND property (in the ValidityAuditStrategy) is not available for the joined class (EntityC) because EntityC has InheritanceStrategy JOINED.
Envers creates a JPQL query for its audit queries, so this issue exists in hibernate core. It seems that whenever an entity is joined with unrelated property join and that Entity has InheritanceStrategy JOINED, no properties of a superclass may be used in the query. I have created a simple example which reproduces this problem in hibernate-core:
In this example the property 'propB' of EntityC is not available since it is defined on superclass EntityB.
Here are the stack traces of the two examples:
The Envers example:
The JPQL example: