HHH-3140 : region prefix for entity and collection caches

git-svn-id: https://svn.jboss.org/repos/hibernate/core/trunk@14443 1b8cb986-b30d-0410-93ca-fae66ebed9b2
This commit is contained in:
Steve Ebersole 2008-03-17 20:19:04 +00:00
parent 41b893ce0b
commit 0e6db9d066
1 changed files with 4 additions and 2 deletions

View File

@ -207,6 +207,8 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
// Prepare persisters and link them up with their cache
// region/access-strategy
final String cacheRegionPrefix = settings.getCacheRegionPrefix() == null ? "" : settings.getCacheRegionPrefix() + ".";
entityPersisters = new HashMap();
Map entityAccessStrategies = new HashMap();
Map classMeta = new HashMap();
@ -214,8 +216,8 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
while ( classes.hasNext() ) {
final PersistentClass model = (PersistentClass) classes.next();
model.prepareTemporaryTables( mapping, settings.getDialect() );
final String cacheRegionName = cacheRegionPrefix + model.getRootClass().getCacheRegionName();
// cache region is defined by the root-class in the hierarchy...
final String cacheRegionName = model.getRootClass().getCacheRegionName();
EntityRegionAccessStrategy accessStrategy = ( EntityRegionAccessStrategy ) entityAccessStrategies.get( cacheRegionName );
if ( accessStrategy == null && settings.isSecondLevelCacheEnabled() ) {
final AccessType accessType = AccessType.parse( model.getCacheConcurrencyStrategy() );
@ -238,7 +240,7 @@ public final class SessionFactoryImpl implements SessionFactory, SessionFactoryI
Iterator collections = cfg.getCollectionMappings();
while ( collections.hasNext() ) {
Collection model = (Collection) collections.next();
final String cacheRegionName = model.getCacheRegionName();
final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
final AccessType accessType = AccessType.parse( model.getCacheConcurrencyStrategy() );
CollectionRegionAccessStrategy accessStrategy = null;
if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {