Search in sources :

Example 1 with EntityRegion

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

Example 2 with EntityRegion

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

Aggregations

EntityRegion (org.hibernate.cache.spi.EntityRegion)2 AccessType (org.hibernate.cache.spi.access.AccessType)1 EntityRegionAccessStrategy (org.hibernate.cache.spi.access.EntityRegionAccessStrategy)1