HHH-13654 Refactor references to StatefulPersistenceContext#batchFetchQueue

This commit is contained in:
Sanne Grinovero 2019-10-29 12:43:38 +00:00
parent 500819e169
commit 6034ece731
1 changed files with 11 additions and 8 deletions

View File

@ -384,8 +384,9 @@ public class StatefulPersistenceContext implements PersistenceContext {
@Override @Override
public void addEntity(EntityKey key, Object entity) { public void addEntity(EntityKey key, Object entity) {
entitiesByKey.put( key, entity ); entitiesByKey.put( key, entity );
if( batchFetchQueue != null ) { final BatchFetchQueue fetchQueue = this.batchFetchQueue;
getBatchFetchQueue().removeBatchLoadableEntityKey(key); if ( fetchQueue != null ) {
fetchQueue.removeBatchLoadableEntityKey(key);
} }
} }
@ -419,9 +420,10 @@ public class StatefulPersistenceContext implements PersistenceContext {
if ( nullifiableEntityKeys != null ) { if ( nullifiableEntityKeys != null ) {
nullifiableEntityKeys.remove( key ); nullifiableEntityKeys.remove( key );
} }
if( batchFetchQueue != null ) { final BatchFetchQueue fetchQueue = this.batchFetchQueue;
getBatchFetchQueue().removeBatchLoadableEntityKey( key ); if ( fetchQueue != null ) {
getBatchFetchQueue().removeSubselect( key ); fetchQueue.removeBatchLoadableEntityKey( key );
fetchQueue.removeSubselect( key );
} }
return entity; return entity;
} }
@ -1044,9 +1046,10 @@ public class StatefulPersistenceContext implements PersistenceContext {
@Override @Override
public Object removeProxy(EntityKey key) { public Object removeProxy(EntityKey key) {
if ( batchFetchQueue != null ) { final BatchFetchQueue fetchQueue = this.batchFetchQueue;
batchFetchQueue.removeBatchLoadableEntityKey( key ); if ( fetchQueue != null ) {
batchFetchQueue.removeSubselect( key ); fetchQueue.removeBatchLoadableEntityKey( key );
fetchQueue.removeSubselect( key );
} }
return removeProxyByKey( key ); return removeProxyByKey( key );
} }