model.getHierarchyDetails().getCaching() != null &&
model.getHierarchyDetails().getCaching().getAccessType() != null ) {
final String cacheRegionName = cacheRegionPrefix + rootEntityBinding.getHierarchyDetails().getCaching().getRegion();
accessStrategy = EntityRegionAccessStrategy.class.cast( entityAccessStrategies.get( cacheRegionName ) );
if ( accessStrategy == null ) {
final AccessType accessType = model.getHierarchyDetails().getCaching().getAccessType();
if ( LOG.isTraceEnabled() ) {
LOG.tracev( "Building cache for entity data [{0}]", model.getEntity().getName() );
}
EntityRegion entityRegion = settings.getRegionFactory().buildEntityRegion(
cacheRegionName, properties, CacheDataDescriptionImpl.decode( model )
);
accessStrategy = entityRegion.buildAccessStrategy( accessType );
entityAccessStrategies.put( cacheRegionName, accessStrategy );
allCacheRegions.put( cacheRegionName, entityRegion );
}
}
EntityPersister cp = serviceRegistry.getService( PersisterFactory.class ).createEntityPersister(
model, accessStrategy, this, metadata
);
entityPersisters.put( model.getEntity().getName(), cp );
classMeta.put( model.getEntity().getName(), cp.getClassMetadata() );
}
this.classMetadata = Collections.unmodifiableMap(classMeta);
Map<String,Set<String>> tmpEntityToCollectionRoleMap = new HashMap<String,Set<String>>();
collectionPersisters = new HashMap();
for ( PluralAttributeBinding model : metadata.getCollectionBindings() ) {
if ( model.getAttribute() == null ) {
throw new IllegalStateException( "No attribute defined for a AbstractPluralAttributeBinding: " + model );
}
if ( model.getAttribute().isSingular() ) {
throw new IllegalStateException(
"AbstractPluralAttributeBinding has a Singular attribute defined: " + model.getAttribute().getName()
);
}
final String cacheRegionName = cacheRegionPrefix + model.getCaching().getRegion();
final AccessType accessType = model.getCaching().getAccessType();
CollectionRegionAccessStrategy accessStrategy = null;
if ( accessType != null && settings.isSecondLevelCacheEnabled() ) {
if ( LOG.isTraceEnabled() ) {
LOG.tracev( "Building cache for collection data [{0}]", model.getAttribute().getRole() );
}