List of usage examples for org.hibernate.cache.cfg.spi DomainDataRegionBuildingContext getSessionFactory
SessionFactoryImplementor getSessionFactory();
From source file:org.redisson.hibernate.RedissonRegionFactory.java
License:Apache License
@Override protected DomainDataStorageAccess createDomainDataStorageAccess(DomainDataRegionConfig regionConfig, DomainDataRegionBuildingContext buildingContext) { String defaultKey = null;/* w w w . j a va 2 s.c o m*/ if (!regionConfig.getCollectionCaching().isEmpty()) { defaultKey = COLLECTION_DEF; } else if (!regionConfig.getEntityCaching().isEmpty()) { defaultKey = ENTITY_DEF; } else if (!regionConfig.getNaturalIdCaching().isEmpty()) { defaultKey = NATURAL_ID_DEF; } else { throw new IllegalArgumentException("Unable to determine entity cache type!"); } RMapCache<Object, Object> mapCache = getCache(regionConfig.getRegionName(), buildingContext.getSessionFactory().getProperties(), defaultKey); return new RedissonStorage(mapCache, buildingContext.getSessionFactory().getProperties(), defaultKey); }