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 92bf2b7d57
commit 56239da312
3 changed files with 5 additions and 5 deletions

View File

@ -216,7 +216,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(),
@ -329,7 +329,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

@ -1220,7 +1220,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 ) {
@ -4299,7 +4299,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 ) {