HHH-9170 StatelessSession is accidentally 2LC enabled in some cases
This commit is contained in:
parent
92bf2b7d57
commit
56239da312
|
@ -216,7 +216,7 @@ public class BatchFetchQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCached(EntityKey entityKey, EntityPersister persister) {
|
private boolean isCached(EntityKey entityKey, EntityPersister persister) {
|
||||||
if ( persister.hasCache() ) {
|
if ( context.getSession().getCacheMode().isGetEnabled() && persister.hasCache() ) {
|
||||||
final CacheKey key = context.getSession().generateCacheKey(
|
final CacheKey key = context.getSession().generateCacheKey(
|
||||||
entityKey.getIdentifier(),
|
entityKey.getIdentifier(),
|
||||||
persister.getIdentifierType(),
|
persister.getIdentifierType(),
|
||||||
|
@ -329,7 +329,7 @@ public class BatchFetchQueue {
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isCached(Serializable collectionKey, CollectionPersister persister) {
|
private boolean isCached(Serializable collectionKey, CollectionPersister persister) {
|
||||||
if ( persister.hasCache() ) {
|
if ( context.getSession().getCacheMode().isGetEnabled() && persister.hasCache() ) {
|
||||||
CacheKey cacheKey = context.getSession().generateCacheKey(
|
CacheKey cacheKey = context.getSession().generateCacheKey(
|
||||||
collectionKey,
|
collectionKey,
|
||||||
persister.getKeyType(),
|
persister.getKeyType(),
|
||||||
|
|
|
@ -1592,7 +1592,7 @@ public abstract class Loader {
|
||||||
);
|
);
|
||||||
|
|
||||||
// see if the entity defines reference caching, and if so use the cached reference (if one).
|
// see if the entity defines reference caching, and if so use the cached reference (if one).
|
||||||
if ( persister.canUseReferenceCacheEntries() ) {
|
if ( session.getCacheMode().isGetEnabled() && persister.canUseReferenceCacheEntries() ) {
|
||||||
final Object cachedEntry = CacheHelper.fromSharedCache(
|
final Object cachedEntry = CacheHelper.fromSharedCache(
|
||||||
session,
|
session,
|
||||||
session.generateCacheKey(
|
session.generateCacheKey(
|
||||||
|
|
|
@ -1220,7 +1220,7 @@ public abstract class AbstractEntityPersister
|
||||||
LOG.tracev( "Initializing lazy properties of: {0}, field access: {1}", MessageHelper.infoString( this, id, getFactory() ), fieldName );
|
LOG.tracev( "Initializing lazy properties of: {0}, field access: {1}", MessageHelper.infoString( this, id, getFactory() ), fieldName );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( hasCache() ) {
|
if ( session.getCacheMode().isGetEnabled() && hasCache() ) {
|
||||||
final CacheKey cacheKey = session.generateCacheKey( id, getIdentifierType(), getEntityName() );
|
final CacheKey cacheKey = session.generateCacheKey( id, getIdentifierType(), getEntityName() );
|
||||||
final Object ce = CacheHelper.fromSharedCache( session, cacheKey, getCacheAccessStrategy() );
|
final Object ce = CacheHelper.fromSharedCache( session, cacheKey, getCacheAccessStrategy() );
|
||||||
if ( ce != null ) {
|
if ( ce != null ) {
|
||||||
|
@ -4299,7 +4299,7 @@ public abstract class AbstractEntityPersister
|
||||||
}
|
}
|
||||||
|
|
||||||
// check to see if it is in the second-level cache
|
// check to see if it is in the second-level cache
|
||||||
if ( hasCache() ) {
|
if ( session.getCacheMode().isGetEnabled() && hasCache() ) {
|
||||||
final CacheKey ck = session.generateCacheKey( id, getIdentifierType(), getRootEntityName() );
|
final CacheKey ck = session.generateCacheKey( id, getIdentifierType(), getRootEntityName() );
|
||||||
final Object ce = CacheHelper.fromSharedCache( session, ck, getCacheAccessStrategy() );
|
final Object ce = CacheHelper.fromSharedCache( session, ck, getCacheAccessStrategy() );
|
||||||
if ( ce != null ) {
|
if ( ce != null ) {
|
||||||
|
|
Loading…
Reference in New Issue