use of org.hibernate.cache.spi.CollectionRegion in project hibernate-orm by hibernate.
the class CollectionRegionImplTest method putInRegion.
@Override
protected void putInRegion(Region region, Object key, Object value) {
CollectionRegionAccessStrategy strategy = ((CollectionRegion) region).buildAccessStrategy(AccessType.TRANSACTIONAL);
strategy.putFromLoad(null, key, value, region.nextTimestamp(), new Integer(1));
}
use of org.hibernate.cache.spi.CollectionRegion in project hibernate-orm by hibernate.
the class CollectionRegionImplTest method supportedAccessTypeTest.
@Override
protected void supportedAccessTypeTest(RegionFactory regionFactory, Properties properties) {
CollectionRegion region = regionFactory.buildCollectionRegion(CACHE_NAME, properties, MUTABLE_NON_VERSIONED);
assertNotNull(region.buildAccessStrategy(accessType));
((InfinispanRegionFactory) regionFactory).getCacheManager().removeCache(CACHE_NAME);
}
use of org.hibernate.cache.spi.CollectionRegion in project hibernate-orm by hibernate.
the class CacheImpl method determineCollectionRegionAccessStrategy.
@Override
public CollectionRegionAccessStrategy determineCollectionRegionAccessStrategy(Collection model) {
final String cacheRegionName = cacheRegionPrefix + model.getCacheRegionName();
CollectionRegionAccessStrategy accessStrategy = collectionRegionAccessStrategyMap.get(cacheRegionName);
if (accessStrategy == null && settings.isSecondLevelCacheEnabled()) {
final AccessType accessType = AccessType.fromExternalName(model.getCacheConcurrencyStrategy());
if (accessType != null) {
LOG.tracev("Building shared cache region for collection data [{0}]", model.getRole());
CollectionRegion collectionRegion = regionFactory.buildCollectionRegion(cacheRegionName, sessionFactory.getProperties(), CacheDataDescriptionImpl.decode(model));
accessStrategy = collectionRegion.buildAccessStrategy(accessType);
collectionRegionAccessStrategyMap.put(cacheRegionName, accessStrategy);
}
}
return accessStrategy;
}
Aggregations