HHH-9629 - l2 cache key constructed wrong for entity with inheritance when fetching lazy property

This commit is contained in:
Steve Ebersole 2015-05-27 11:52:17 -05:00
parent a51f300253
commit 5514aea2b4
2 changed files with 2 additions and 2 deletions

View File

@ -205,7 +205,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

@ -906,7 +906,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 );