Skip to content

Commit

Permalink
HHH-12146  - Support enabling caching at any level within a mapped hi…
Browse files Browse the repository at this point in the history
…erarchy
  • Loading branch information
Naros committed Dec 14, 2017
1 parent 58e6235 commit 9f50157
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ public void applyCaching(
}
}

cacheConcurrentStrategy = effectiveCacheAnn.usage().name();
cacheConcurrentStrategy = resolveCacheConcurrencyStrategy( effectiveCacheAnn.usage() );
cacheRegion = effectiveCacheAnn.region();
switch ( effectiveCacheAnn.include().toLowerCase( Locale.ROOT ) ) {
case "all": {
Expand Down Expand Up @@ -674,6 +674,11 @@ else if ( explicitCacheableAnn == null && persistentClass.getSuperclass() != nul
}
}

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 ) );
}
Expand Down

0 comments on commit 9f50157

Please sign in to comment.