HHH-12146  - Support enabling caching at any level within a mapped hierarchy

This commit is contained in:
Chris Cranford 2017-12-14 11:37:45 -05:00
parent 58e6235c6b
commit 9f50157a60
1 changed files with 6 additions and 1 deletions

View File

@ -600,7 +600,7 @@ public class EntityBinder {
}
}
cacheConcurrentStrategy = effectiveCacheAnn.usage().name();
cacheConcurrentStrategy = resolveCacheConcurrencyStrategy( effectiveCacheAnn.usage() );
cacheRegion = effectiveCacheAnn.region();
switch ( effectiveCacheAnn.include().toLowerCase( Locale.ROOT ) ) {
case "all": {
@ -674,6 +674,11 @@ public class EntityBinder {
}
}
private static String resolveCacheConcurrencyStrategy(CacheConcurrencyStrategy strategy) {
final org.hibernate.cache.spi.access.AccessType accessType = strategy.toAccessType();
return accessType == null ? null : accessType.getExternalName();
}
private static Cache buildCacheMock(String region, MetadataBuildingContext context) {
return new LocalCacheAnnotationStub( region, determineCacheConcurrencyStrategy( context ) );
}