From 520cb95fa6ba661ba3205b34c1eca5f5ccbd6186 Mon Sep 17 00:00:00 2001 From: Andrea Boriero Date: Tue, 18 Aug 2020 09:20:04 +0100 Subject: [PATCH] Fix runtime model build error --- .../src/main/java/org/hibernate/mapping/PersistentClass.java | 4 +++- .../hibernate/persister/entity/AbstractEntityPersister.java | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java index 5631fc3fd9..33876bea8d 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java @@ -506,7 +506,9 @@ public abstract class PersistentClass implements AttributeContainer, Serializabl String root = StringHelper.root( propertyName ); while ( iterator.hasNext() ) { Property prop = (Property) iterator.next(); - if ( prop.getName().equals( root ) ) { + if ( prop.getName().equals( root ) + || (prop instanceof Backref || prop instanceof IndexBackref) + && prop.getName().equals( propertyName ) ) { return prop; } } diff --git a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java index 6a75bf1bc4..4a233ef1bd 100644 --- a/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java +++ b/hibernate-core/src/main/java/org/hibernate/persister/entity/AbstractEntityPersister.java @@ -5858,8 +5858,9 @@ public abstract class AbstractEntityPersister final EntityMetamodel currentEntityMetamodel = this.getEntityMetamodel(); int stateArrayPosition = getStateArrayInitialPosition( creationProcess ); + NonIdentifierAttribute[] properties = currentEntityMetamodel.getProperties(); for ( int i = 0; i < currentEntityMetamodel.getPropertySpan(); i++ ) { - final NonIdentifierAttribute runtimeAttrDefinition = currentEntityMetamodel.getProperties()[i]; + final NonIdentifierAttribute runtimeAttrDefinition = properties[i]; final Property bootProperty = bootEntityDescriptor.getProperty( runtimeAttrDefinition.getName() ); if ( superMappingType != null && superMappingType.findAttributeMapping( bootProperty.getName() ) != null ) {