Found a bug in
org.hibernate.tuple.entity.EntityMetamodel.
In the constructor the following code executes in order to place entries into entityNameByInheritenceClassNameMap with keys of type Class, values of type String:
Code:
if ( persistentClass.hasPojoRepresentation() ) {
entityNameByInheritenceClassNameMap.put( persistentClass.getMappedClass(), persistentClass.getEntityName() );
iter = persistentClass.getSubclassIterator();
while ( iter.hasNext() ) {
final PersistentClass pc = ( PersistentClass ) iter.next();
entityNameByInheritenceClassNameMap.put( pc.getMappedClass(), pc.getEntityName() );
}
}
In the same class, we have:
Code:
public String findEntityNameByEntityClass(Class inheritenceClass) {
return ( String ) entityNameByInheritenceClassNameMap.get( inheritenceClass.getName() );
}
Which is passing in a Key of type String, meaning the call will never succeed.
Discovered whilst using EntityPersister.findDirty in combination with Hibernate Envers to calculate the differences between two saved snapshots.