Author: steve.ebersole(a)jboss.com
Date: 2008-03-17 16:19:04 -0400 (Mon, 17 Mar 2008)
New Revision: 14443
Modified:
core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
Log:
HHH-3140 : region prefix for entity and collection caches
Modified: core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2008-03-16
16:54:12 UTC (rev 14442)
+++ core/trunk/core/src/main/java/org/hibernate/impl/SessionFactoryImpl.java 2008-03-17
20:19:04 UTC (rev 14443)
@@ -207,6 +207,8 @@
// 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 @@
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 @@
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() ) {
Show replies by date