Search in sources :

Example 1 with CollectionRegion

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));
}
Also used : CollectionRegion(org.hibernate.cache.spi.CollectionRegion) CollectionRegionAccessStrategy(org.hibernate.cache.spi.access.CollectionRegionAccessStrategy)

Example 2 with CollectionRegion

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);
}
Also used : CollectionRegion(org.hibernate.cache.spi.CollectionRegion)

Example 3 with CollectionRegion

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;
}
Also used : CollectionRegion(org.hibernate.cache.spi.CollectionRegion) CollectionRegionAccessStrategy(org.hibernate.cache.spi.access.CollectionRegionAccessStrategy) AccessType(org.hibernate.cache.spi.access.AccessType)

Aggregations

CollectionRegion (org.hibernate.cache.spi.CollectionRegion)3 CollectionRegionAccessStrategy (org.hibernate.cache.spi.access.CollectionRegionAccessStrategy)2 AccessType (org.hibernate.cache.spi.access.AccessType)1