mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-25 21:04:51 +00:00
HHH-9629 - l2 cache key constructed wrong for entity with inheritance when fetching lazy property
This commit is contained in:
parent
a51f300253
commit
5514aea2b4
@ -205,7 +205,7 @@ private boolean isCached(EntityKey entityKey, EntityPersister persister) {
|
||||
final CacheKey key = context.getSession().generateCacheKey(
|
||||
entityKey.getIdentifier(),
|
||||
persister.getIdentifierType(),
|
||||
entityKey.getEntityName()
|
||||
persister.getRootEntityName()
|
||||
);
|
||||
return CacheHelper.fromSharedCache( context.getSession(), key, persister.getCacheAccessStrategy() ) != null;
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ public Object initializeLazyProperty(String fieldName, Object entity, SessionImp
|
||||
}
|
||||
|
||||
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 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user