HHH-17464 6.4.0 regression: NullPointerException in DefaultEvictEventListener#onEvict

This commit is contained in:
Andrea Boriero 2023-11-28 13:48:46 +01:00 committed by Andrea Boriero
parent aefebd302d
commit 87d24f157e
1 changed files with 2 additions and 1 deletions

View File

@ -59,7 +59,8 @@ public class DefaultEvictEventListener implements EvictEventListener {
.getEntityDescriptor( lazyInitializer.getEntityName() ); .getEntityDescriptor( lazyInitializer.getEntityName() );
final EntityKey key = source.generateEntityKey( id, persister ); final EntityKey key = source.generateEntityKey( id, persister );
final EntityHolder holder = persistenceContext.removeEntityHolder( key ); final EntityHolder holder = persistenceContext.removeEntityHolder( key );
if ( !lazyInitializer.isUninitialized() ) { // if the entity has been evicted then its holder is null
if ( holder != null && !lazyInitializer.isUninitialized() ) {
final Object entity = holder.getEntity(); final Object entity = holder.getEntity();
if ( entity != null ) { if ( entity != null ) {
EntityEntry entry = persistenceContext.removeEntry( entity ); EntityEntry entry = persistenceContext.removeEntry( entity );