From 5cc79fbd38f4cdbccd3528a35299bb49e361d057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=8Cedomir=20Igaly?= Date: Thu, 21 Nov 2024 12:29:28 +0100 Subject: [PATCH] HHH-18384 Changes after PR comments --- .../org/hibernate/boot/model/internal/EntityBinder.java | 3 ++- .../org/hibernate/boot/model/internal/PropertyBinder.java | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java index c2a3226c7e..fc6259bc7f 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/EntityBinder.java @@ -633,7 +633,8 @@ public class EntityBinder { inferredData.getPropertyType(), propertyAccessor ); - addElementsOfClass( baseClassElements, propContainer, context, 0 ); + final int idPropertyCount = addElementsOfClass( baseClassElements, propContainer, context, 0 ); + assert idPropertyCount == 1; //Id properties are on top and there is only one return baseClassElements.get( 0 ); } diff --git a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java index 668cbca1c4..0763929675 100644 --- a/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java +++ b/hibernate-core/src/main/java/org/hibernate/boot/model/internal/PropertyBinder.java @@ -585,8 +585,8 @@ public class PropertyBinder { * @param propertyContainer Metadata about a class and its properties * @param idPropertyCounter number of id properties already present in list of {@link PropertyData} instances * - * @return total number of id properties found after iterating the elements of - * {@code annotatedClass} using the determined access strategy + * @return total number of id properties found after iterating the elements of {@code annotatedClass} + * using the determined access strategy (starting from the provided {@code idPropertyCounter}) */ static int addElementsOfClass( List elements, @@ -602,7 +602,8 @@ public class PropertyBinder { PropertyContainer propertyContainer, MemberDetails property, List inFlightPropertyDataList, - MetadataBuildingContext context, int idPropertyCounter) { + MetadataBuildingContext context, + int idPropertyCounter) { // see if inFlightPropertyDataList already contains a PropertyData for this name, // and if so, skip it... for ( PropertyData propertyData : inFlightPropertyDataList ) {