HHH-9170 StatelessSession is accidentally 2LC enabled in some cases

This commit is contained in:
Brett Meyer 2014-05-09 11:55:41 -04:00
parent 26c7400c0a
commit 47204593f6
3 changed files with 5 additions and 5 deletions

View File

@ -218,7 +218,7 @@ public class BatchFetchQueue {
}
private boolean isCached(EntityKey entityKey, EntityPersister persister) {
if ( persister.hasCache() ) {
if ( context.getSession().getCacheMode().isGetEnabled() && persister.hasCache() ) {
final CacheKey key = context.getSession().generateCacheKey(
entityKey.getIdentifier(),
persister.getIdentifierType(),
@ -331,7 +331,7 @@ public class BatchFetchQueue {
}
private boolean isCached(Serializable collectionKey, CollectionPersister persister) {
if ( persister.hasCache() ) {
if ( context.getSession().getCacheMode().isGetEnabled() && persister.hasCache() ) {
CacheKey cacheKey = context.getSession().generateCacheKey(
collectionKey,
persister.getKeyType(),

View File

@ -1592,7 +1592,7 @@ public abstract class Loader {
);
// 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(
session,
session.generateCacheKey(

View File

@ -1004,7 +1004,7 @@ public abstract class AbstractEntityPersister
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 Object ce = CacheHelper.fromSharedCache( session, cacheKey, getCacheAccessStrategy() );
if ( ce != null ) {
@ -4342,7 +4342,7 @@ public abstract class AbstractEntityPersister
}
// 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 Object ce = CacheHelper.fromSharedCache( session, ck, getCacheAccessStrategy() );
if ( ce != null ) {