From c18b7c90fe09bc62d32a1de3c4ca404dc5f832a0 Mon Sep 17 00:00:00 2001 From: Gavin King Date: Mon, 7 Oct 2024 19:05:58 +0200 Subject: [PATCH] eliminate dupe log message --- .../java/org/hibernate/mapping/RootClass.java | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/RootClass.java b/hibernate-core/src/main/java/org/hibernate/mapping/RootClass.java index fd452a17a2..574a808e96 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/RootClass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/RootClass.java @@ -13,8 +13,9 @@ import org.hibernate.boot.Metadata; import org.hibernate.boot.spi.MetadataBuildingContext; import org.hibernate.internal.CoreLogging; import org.hibernate.internal.CoreMessageLogger; -import org.hibernate.internal.util.ReflectHelper; +import static org.hibernate.internal.util.ReflectHelper.overridesEquals; +import static org.hibernate.internal.util.ReflectHelper.overridesHashCode; import static org.hibernate.internal.util.StringHelper.nullIfEmpty; /** @@ -325,17 +326,15 @@ public class RootClass extends PersistentClass implements TableOwner, SoftDeleta * correct) we simply log a warning. */ private void checkCompositeIdentifier() { - if ( getIdentifier() instanceof Component id ) { - if ( !id.isDynamic() ) { - final Class idClass = id.getComponentClass(); - if ( idClass != null ) { - final String idComponentClassName = idClass.getName(); - if ( !ReflectHelper.overridesEquals( idClass ) ) { - LOG.compositeIdClassDoesNotOverrideEquals( idComponentClassName ); - } - if ( !ReflectHelper.overridesHashCode( idClass ) ) { - LOG.compositeIdClassDoesNotOverrideHashCode( idComponentClassName ); - } + if ( getIdentifier() instanceof Component id + && !id.isDynamic() ) { + final Class idClass = id.getComponentClass(); + if ( idClass != null ) { + if ( !overridesEquals( idClass ) ) { + LOG.compositeIdClassDoesNotOverrideEquals( idClass.getName() ); + } + else if ( !overridesHashCode( idClass ) ) { + LOG.compositeIdClassDoesNotOverrideHashCode( idClass.getName() ); } } }