use of org.hibernate.cache.spi.EntityRegion in project hibernate-orm by hibernate.
the class EntityRegionImplTest method supportedAccessTypeTest.
@Override
protected void supportedAccessTypeTest(RegionFactory regionFactory, Properties properties) {
EntityRegion region = regionFactory.buildEntityRegion("test", properties, MUTABLE_NON_VERSIONED);
assertNotNull(region.buildAccessStrategy(accessType));
((InfinispanRegionFactory) regionFactory).getCacheManager().removeCache(CACHE_NAME);
}
use of org.hibernate.cache.spi.EntityRegion in project hibernate-orm by hibernate.
the class CacheImpl method determineEntityRegionAccessStrategy.
@Override
public EntityRegionAccessStrategy determineEntityRegionAccessStrategy(PersistentClass model) {
final String cacheRegionName = cacheRegionPrefix + model.getRootClass().getCacheRegionName();
EntityRegionAccessStrategy accessStrategy = entityRegionAccessStrategyMap.get(cacheRegionName);
if (accessStrategy == null && settings.isSecondLevelCacheEnabled()) {
final AccessType accessType = AccessType.fromExternalName(model.getCacheConcurrencyStrategy());
if (accessType != null) {
LOG.tracef("Building shared cache region for entity data [%s]", model.getEntityName());
EntityRegion entityRegion = regionFactory.buildEntityRegion(cacheRegionName, sessionFactory.getProperties(), CacheDataDescriptionImpl.decode(model));
accessStrategy = entityRegion.buildAccessStrategy(accessType);
entityRegionAccessStrategyMap.put(cacheRegionName, accessStrategy);
}
}
return accessStrategy;
}
Aggregations