HHH-16565 Clear PC entry for 2LC inconsistent return class entities
This commit is contained in:
parent
f0affe7804
commit
e84dfb2a8c
|
@ -317,12 +317,11 @@ public class CacheEntityLoaderHelper {
|
|||
Object entity = convertCacheEntryToEntity( entry, entityKey.getIdentifier(), source, persister, instanceToLoad, entityKey );
|
||||
|
||||
if ( !persister.isInstance( entity ) ) {
|
||||
// Cleanup the inconsistent return class entity from the persistence context
|
||||
final PersistenceContext persistenceContext = source.getPersistenceContext();
|
||||
persistenceContext.removeEntry( entity );
|
||||
persistenceContext.removeEntity( entityKey );
|
||||
return null;
|
||||
// throw new WrongClassException(
|
||||
// "loaded object was of wrong class " + entity.getClass(),
|
||||
// entityKey.getIdentifier(),
|
||||
// persister.getEntityName()
|
||||
// );
|
||||
}
|
||||
|
||||
return entity;
|
||||
|
|
Loading…
Reference in New Issue