Buggy code:
public class DataCacheStoreManager extends DelegatingStoreManager { private Collection _inserts = null ; private Map _updates = null ; private Collection _deletes = null ; private StoreContext _ctx = null ; private PCDataGenerator _gen = null ; public DataCacheStoreManager ( StoreManager sm ) { } public void setContext ( StoreContext ctx ) { } public void begin ( ) { } public void commit ( ) { } public void rollback ( ) { } private void evictTypes ( Collection classes ) { } private void updateCaches ( ) { } private void transformToVersionSafePCDatas ( DataCache cache , List holders ) { } private static DataCacheStoreManager . Modifications getModifications ( Map modMap , DataCache cache ) { } public boolean exists ( OpenJPAStateManager sm , Object edata ) { } public boolean syncVersion ( OpenJPAStateManager sm , Object edata ) { } public boolean initialize ( OpenJPAStateManager sm , PCState state , FetchConfiguration fetch , Object edata ) { } public boolean load ( OpenJPAStateManager sm , BitSet fields , FetchConfiguration fetch , int lockLevel , Object edata ) { } public Collection loadAll ( Collection sms , PCState state , int load , FetchConfiguration fetch , Object edata ) { <START_BUG> if ( isLocking ( fetch ) ) <END_BUG> return super . loadAll ( sms , state , load , fetch , edata ) ; Map unloaded = null ; List smList = null ; Map caches = new HashMap ( ) ; OpenJPAStateManager sm ; DataCache cache ; DataCachePCData data ; BitSet fields ; for ( Iterator itr = sms . iterator ( ) ; itr . hasNext ( ) ; ) { sm = ( ( OpenJPAStateManager ) ( itr . next ( ) ) ) ; cache = sm . getMetaData ( ) . getDataCache ( ) ; if ( ( cache == null ) || ( sm . isEmbedded ( ) ) ) { unloaded = DataCacheStoreManager . addUnloaded ( sm , null , unloaded ) ; continue ; } if ( ( ( ( sm . getManagedInstance ( ) ) == null ) || ( load != ( FORCE_LOAD_NONE ) ) ) || ( ( sm . getPCState ( ) ) == ( PCState . HOLLOW ) ) ) { smList = ( ( List ) ( caches . get ( cache ) ) ) ; if ( smList == null ) { smList = new ArrayList ( ) ; caches . put ( cache , smList ) ; } smList . add ( sm ) ; } else if ( ! ( cache . contains ( sm . getObjectId ( ) ) ) ) unloaded = DataCacheStoreManager . addUnloaded ( sm , null , unloaded ) ; } for ( Iterator itr = caches . keySet ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { cache = ( ( DataCache ) ( itr . next ( ) ) ) ; smList = ( ( List ) ( caches . get ( cache ) ) ) ; List oidList = new ArrayList ( smList . size ( ) ) ; for ( itr = smList . iterator ( ) ; itr . hasNext ( ) ; ) { sm = ( ( OpenJPAStateManager ) ( itr . next ( ) ) ) ; oidList . add ( ( ( OpenJPAId ) ( sm . getObjectId ( ) ) ) ) ; } Map dataMap = cache . getAll ( oidList ) ; for ( itr = smList . iterator ( ) ; itr . hasNext ( ) ; ) { sm = ( ( OpenJPAStateManager ) ( itr . next ( ) ) ) ; data = ( ( DataCachePCData ) ( dataMap . get ( ( ( OpenJPAId ) ( sm . getObjectId ( ) ) ) ) ) ) ; if ( ( sm . getManagedInstance ( ) ) == null ) { if ( data != null ) { sm . initialize ( data . getType ( ) , state ) ; data . load ( sm , fetch , edata ) ; } else unloaded = DataCacheStoreManager . addUnloaded ( sm , null , unloaded ) ; } else if ( ( load != ( FORCE_LOAD_NONE ) ) || ( ( sm . getPCState ( ) ) == ( PCState . HOLLOW ) ) ) { data = cache . get ( sm . getObjectId ( ) ) ; if ( data != null ) { fields = sm . getUnloaded ( fetch ) ; data . load ( sm , fields , fetch , edata ) ; if ( ( fields . length ( ) ) > 0 ) unloaded = DataCacheStoreManager . addUnloaded ( sm , fields , unloaded ) ; } else unloaded = DataCacheStoreManager . addUnloaded ( sm , null , unloaded ) ; } } } if ( unloaded == null ) return Collections . EMPTY_LIST ; Collection failed = super . loadAll ( unloaded . keySet ( ) , state , load , fetch , edata ) ; if ( ! ( _ctx . getPopulateDataCache ( ) ) ) return failed ; Map . Entry entry ; boolean isNew ; for ( Iterator itr = unloaded . entrySet ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { entry = ( ( Map . Entry ) ( itr . next ( ) ) ) ; sm = ( ( OpenJPAStateManager ) ( entry . getKey ( ) ) ) ; fields = ( ( BitSet ) ( entry . getValue ( ) ) ) ; cache = sm . getMetaData ( ) . getDataCache ( ) ; if ( ( ( cache == null ) || ( sm . isEmbedded ( ) ) ) || ( ( failed != null ) && ( failed . contains ( sm . getId ( ) ) ) ) ) continue ; cache . writeLock ( ) ;

Fix:
if ( ( load == ( StoreManager . FORCE_LOAD_REFRESH ) ) || ( isLocking ( fetch ) ) )