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 8d79d0e451aa..00d22e18b5fd 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 @@ private static PropertyData getUniqueIdPropertyFromBaseClass( 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 668cbca1c4bd..01423c2e2a2b 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 @@ private void validateOptimisticLock(boolean excluded) { * @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 (starting from the provided {@code idPropertyCounter} found + * after iterating the elements of {@code annotatedClass} using the determined access strategy */ static int addElementsOfClass( List elements, @@ -602,7 +602,8 @@ private static int addProperty( 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 ) {