HHH-12617 - Improved cache warning on non-root entity configurations.

This commit is contained in:
Chris Cranford 2018-05-23 09:34:59 -04:00
parent 898f900a87
commit ae890b4623
2 changed files with 7 additions and 2 deletions

View File

@ -622,7 +622,11 @@ public class EntityBinder {
}
else {
if ( explicitCacheAnn != null ) {
LOG.cacheOrCacheableAnnotationOnNonRoot( persistentClass.getClassName() );
LOG.cacheOrCacheableAnnotationOnNonRoot(
persistentClass.getClassName() == null
? annotatedClass.getName()
: persistentClass.getClassName()
);
}
else if ( explicitCacheableAnn == null && persistentClass.getSuperclass() != null ) {
// we should inherit our super's caching config

View File

@ -1770,7 +1770,8 @@ public interface CoreMessageLogger extends BasicLogger {
void unknownJavaTypeNoEqualsHashCode(Class javaType);
@LogMessage(level = WARN)
@Message(value = "@org.hibernate.annotations.Cache used on a non-root entity: ignored for %s", id = 482)
@Message(value = "@org.hibernate.annotations.Cache used on a non-root entity: ignored for [%s]. Please " +
"see the Hibernate documentation for proper usage.", id = 482)
void cacheOrCacheableAnnotationOnNonRoot(String className);
@LogMessage(level = WARN)