HHH-9114 - Fix property not found when IdClass properties are mapped both in entity and mapped superclass types.

This commit is contained in:
Chris Cranford 2017-02-27 22:31:21 -05:00
parent 959e3867d1
commit 761ea6c941
1 changed files with 9 additions and 4 deletions

View File

@ -2627,10 +2627,15 @@ public final class AnnotationBinder {
baseClassElements = new ArrayList<PropertyData>();
baseReturnedClassOrElement = baseInferredData.getClassOrElement();
bindTypeDefs( baseReturnedClassOrElement, buildingContext );
PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement, xClassProcessed, propertyAccessor );
addElementsOfClass( baseClassElements, propContainer, buildingContext );
for ( PropertyData element : baseClassElements ) {
orderedBaseClassElements.put( element.getPropertyName(), element );
// iterate from base returned class up hierarchy to handle cases where the @Id attributes
// might be spread across the subclasses and super classes.
while ( !Object.class.getName().equals( baseReturnedClassOrElement.getName() ) ) {
PropertyContainer propContainer = new PropertyContainer( baseReturnedClassOrElement, xClassProcessed, propertyAccessor );
addElementsOfClass( baseClassElements, propContainer, buildingContext );
for ( PropertyData element : baseClassElements ) {
orderedBaseClassElements.put( element.getPropertyName(), element );
}
baseReturnedClassOrElement = baseReturnedClassOrElement.getSuperclass();
}
}