HHH-10418 : Fix inconsistency between SessionFactoryImpl and CacheImpl

This commit is contained in:
Gail Badner 2018-01-05 12:24:30 -08:00
parent 25bf9b643a
commit 528ba5c9d1
1 changed files with 15 additions and 2 deletions

View File

@ -1173,8 +1173,21 @@ public final class SessionFactoryImpl implements SessionFactoryImplementor {
@Override
public RegionAccessStrategy getSecondLevelCacheRegionAccessStrategy(String regionName) {
EntityRegionAccessStrategy entityStrategy = entityRegionAccessStrategyMap.get(regionName);
return entityStrategy != null ? entityStrategy : collectionRegionAccessStrategyMap.get(regionName);
RegionAccessStrategy strategy = entityRegionAccessStrategyMap.get( regionName );
if ( strategy != null ) {
return strategy;
}
strategy = collectionRegionAccessStrategyMap.get( regionName );
if ( strategy != null ) {
return strategy;
}
// Although #getNaturalIdCacheRegionAccessStrategy should be called to get a
// NaturalIdCacheRegionAccessStrategy, earlier versions of this method would have
// returned a NaturalIdCacheRegionAccessStrategy (instead of null) if regionName
// was used for a NaturalIdCacheRegionAccessStrategy.
// The following is included in order to avoid breaking existing applications.
return naturalIdRegionAccessStrategyMap.get( regionName );
}
public Region getNaturalIdCacheRegion(String regionName) {