accessStrategy = entityRegion.buildAccessStrategy( accessType );
entityAccessStrategies.put( cacheRegionName, accessStrategy );
allCacheRegions.put( cacheRegionName, entityRegion );
}
}
EntityPersister cp = PersisterFactory.createClassPersister( model, accessStrategy, this, cfg.getMapping() );
tmpEntityPersisters.put( model.getEntityName(), cp );
tmpClassMetadata.put( model.getEntityName(), cp.getClassMetadata() );
}
//Named Queries:
namedQueries.putAll(cfg.getNamedQueries());
namedSqlQueries.putAll( cfg.getNamedSQLQueries() );
sqlResultSetMappings.putAll(cfg.getSqlResultSetMappings());
imports.putAll(cfg.getImports());
entityPersisters.putAll(tmpEntityPersisters);
classMetadata.putAll(tmpClassMetadata);
Map tmpEntityToCollectionRoleMap = new HashMap();
Map tempCollectionPersisters=new HashMap();
this.configuration.getCollectionMap().putAll(cfg.getCollectionMap());
Iterator collections = cfg.getCollectionMappings();
while ( collections.hasNext() ) {
final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
final AccessType accessType = AccessType.parse( model.getCacheConcurrencyStrategy() );
CollectionRegionAccessStrategy accessStrategy = null;
if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
log.trace( "Building cache for collection data [" + model.getRole() + "]" );
CollectionRegion collectionRegion = settings.getRegionFactory().buildCollectionRegion( cacheRegionName, properties, CacheDataDescriptionImpl.decode( model ) );
accessStrategy = collectionRegion.buildAccessStrategy( accessType );
entityAccessStrategies.put( cacheRegionName, accessStrategy );
allCacheRegions.put( cacheRegionName, collectionRegion );
}
CollectionPersister persister = PersisterFactory.createCollectionPersister(this.getConfiguration(), model, accessStrategy, this) ;
tempCollectionPersisters.put( model.getRole(), persister.getCollectionMetadata() );
Type indexType = persister.getIndexType();
if ( indexType != null && indexType.isAssociationType() && !indexType.isAnyType() ) {
String entityName = ( ( AssociationType ) indexType ).getAssociatedEntityName( this );
Set roles = ( Set ) tmpEntityToCollectionRoleMap.get( entityName );
if ( roles == null ) {
roles = new HashSet();
tmpEntityToCollectionRoleMap.put( entityName, roles );
}
roles.add( persister.getRole() );
}
Type elementType = persister.getElementType();
if ( elementType.isAssociationType() && !elementType.isAnyType() ) {
String entityName = ( ( AssociationType ) elementType ).getAssociatedEntityName( this );
Set roles = ( Set ) tmpEntityToCollectionRoleMap.get( entityName );
if ( roles == null ) {