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 8d79d0e451..00d22e18b5 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 @@ -634,7 +634,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 ) {