@@ -593,7 +593,7 @@ static int addElementsOfClass(
593
593
MetadataBuildingContext context) {
594
594
int idPropertyCounter = 0;
595
595
for ( MemberDetails property : propertyContainer.propertyIterator() ) {
596
- idPropertyCounter + = addProperty( propertyContainer, property, elements, context );
596
+ idPropertyCounter = addProperty( propertyContainer, property, elements, context, idPropertyCounter );
597
597
}
598
598
return idPropertyCounter;
599
599
}
@@ -602,20 +602,19 @@ private static int addProperty(
602
602
PropertyContainer propertyContainer,
603
603
MemberDetails property,
604
604
List<PropertyData> inFlightPropertyDataList,
605
- MetadataBuildingContext context) {
605
+ MetadataBuildingContext context, int idPropertyCounter ) {
606
606
// see if inFlightPropertyDataList already contains a PropertyData for this name,
607
607
// and if so, skip it...
608
608
for ( PropertyData propertyData : inFlightPropertyDataList ) {
609
609
if ( propertyData.getPropertyName().equals( property.resolveAttributeName() ) ) {
610
610
checkIdProperty( property, propertyData );
611
611
// EARLY EXIT!!!
612
- return 0 ;
612
+ return idPropertyCounter ;
613
613
}
614
614
}
615
615
616
616
final ClassDetails declaringClass = propertyContainer.getDeclaringClass();
617
617
final TypeVariableScope ownerType = propertyContainer.getTypeAtStake();
618
- int idPropertyCounter = 0;
619
618
final PropertyData propertyAnnotatedElement = new PropertyInferredData(
620
619
declaringClass,
621
620
ownerType,
@@ -628,7 +627,7 @@ private static int addProperty(
628
627
// before any association by Hibernate
629
628
final MemberDetails element = propertyAnnotatedElement.getAttributeMember();
630
629
if ( hasIdAnnotation( element ) ) {
631
- inFlightPropertyDataList.add( 0 , propertyAnnotatedElement );
630
+ inFlightPropertyDataList.add( idPropertyCounter , propertyAnnotatedElement );
632
631
handleIdProperty( propertyContainer, context, declaringClass, ownerType, element );
633
632
if ( hasToOneAnnotation( element ) ) {
634
633
context.getMetadataCollector()
0 commit comments