HHH-10314 Don't create the batch fetch queue to remove entities, as a null queue cannot contain the entity

This commit is contained in:
Stuart Douglas 2015-11-22 14:13:42 +11:00 committed by Sanne Grinovero
parent 5a0d23ea5a
commit 17b9a06d6d
1 changed files with 7 additions and 3 deletions

View File

@ -383,7 +383,9 @@ public class StatefulPersistenceContext implements PersistenceContext {
@Override
public void addEntity(EntityKey key, Object entity) {
entitiesByKey.put( key, entity );
getBatchFetchQueue().removeBatchLoadableEntityKey( key );
if( batchFetchQueue != null ) {
getBatchFetchQueue().removeBatchLoadableEntityKey(key);
}
}
@Override
@ -409,8 +411,10 @@ public class StatefulPersistenceContext implements PersistenceContext {
parentsByChild.clear();
entitySnapshotsByKey.remove( key );
nullifiableEntityKeys.remove( key );
getBatchFetchQueue().removeBatchLoadableEntityKey( key );
getBatchFetchQueue().removeSubselect( key );
if( batchFetchQueue != null ) {
getBatchFetchQueue().removeBatchLoadableEntityKey(key);
getBatchFetchQueue().removeSubselect(key);
}
return entity;
}