diff --git a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java index 51262e13d9..ac298b95d2 100644 --- a/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/cfg/annotations/EntityBinder.java @@ -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 ) ); }