use of org.hibernate.engine.spi.CacheImplementor in project hibernate-orm by hibernate.
the class RegionNameTest method testLegacyCacheSpi.
@Test
public void testLegacyCacheSpi() {
// these need to be the prefixed name
final String regionName = cachePrefix + '.' + localName;
final CacheImplementor cache = sessionFactory().getCache();
// just like stats, the cache for queries cannot be accessed second level cache regions map
assertEquals(2, cache.getSecondLevelCacheRegionNames().length);
boolean foundRegion = false;
for (String name : cache.getSecondLevelCacheRegionNames()) {
if (EqualsHelper.areEqual(name, regionName)) {
foundRegion = true;
break;
}
}
if (!foundRegion) {
fail("Could not find region [" + regionName + "] in reported list of region names");
}
final NavigableRole personEntityName = new NavigableRole(Person.class.getName());
final NavigableRole nickNamesRole = personEntityName.append("nickNames");
assert cache.getEntityRegionAccess(personEntityName) != null;
assert cache.getNaturalIdCacheRegionAccessStrategy(personEntityName) != null;
assert cache.getCollectionRegionAccess(nickNamesRole) != null;
}
Aggregations