HHH-9629 Use root entity name for constructing cache key

This commit is contained in:
Nicolas Noffke 2015-02-25 14:08:45 +01:00 committed by Steve Ebersole
parent 21f7c44e68
commit 8d6c318797
2 changed files with 2 additions and 2 deletions

View File

@ -222,7 +222,7 @@ public class BatchFetchQueue {
final CacheKey key = context.getSession().generateCacheKey(
entityKey.getIdentifier(),
persister.getIdentifierType(),
entityKey.getEntityName()
persister.getRootEntityName()
);
return CacheHelper.fromSharedCache( context.getSession(), key, persister.getCacheAccessStrategy() ) != null;
}

View File

@ -1235,7 +1235,7 @@ public abstract class AbstractEntityPersister
}
if ( session.getCacheMode().isGetEnabled() && hasCache() ) {
final CacheKey cacheKey = session.generateCacheKey( id, getIdentifierType(), getEntityName() );
final CacheKey cacheKey = session.generateCacheKey( id, getIdentifierType(), getRootEntityName() );
final Object ce = CacheHelper.fromSharedCache( session, cacheKey, getCacheAccessStrategy() );
if ( ce != null ) {
final CacheEntry cacheEntry = (CacheEntry) getCacheEntryStructure().destructure(ce, factory);