diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveAbstractEntityPersister.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveAbstractEntityPersister.java index b9e692d15..671dbd0b4 100644 --- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveAbstractEntityPersister.java +++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveAbstractEntityPersister.java @@ -556,7 +556,9 @@ default NaturalIdMapping generateNaturalIdMapping( // in the collected names. iterate here because it is already alphabetical final List collectedAttrMappings = new ArrayList<>(); - for ( AttributeMapping attributeMapping : getAttributeMappings() ) { + final AttributeMappingsList attributeMappings = getAttributeMappings(); + for ( int i = 0; i < attributeMappings.size(); i++ ) { + AttributeMapping attributeMapping = attributeMappings.get( i ); if ( attributeNames.contains( attributeMapping.getAttributeName() ) ) { collectedAttrMappings.add( (SingularAttributeMapping) attributeMapping ); } diff --git a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveCoordinatorFactory.java b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveCoordinatorFactory.java index 558ff1da8..df60561f2 100644 --- a/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveCoordinatorFactory.java +++ b/hibernate-reactive-core/src/main/java/org/hibernate/reactive/persister/entity/impl/ReactiveCoordinatorFactory.java @@ -7,6 +7,7 @@ import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.metamodel.mapping.AttributeMapping; +import org.hibernate.metamodel.mapping.AttributeMappingsList; import org.hibernate.metamodel.mapping.SingularAttributeMapping; import org.hibernate.persister.entity.AbstractEntityPersister; import org.hibernate.reactive.persister.entity.mutation.ReactiveDeleteCoordinator; @@ -27,7 +28,9 @@ public static ReactiveUpdateCoordinator buildUpdateCoordinator( AbstractEntityPersister entityPersister, SessionFactoryImplementor factory) { // we only have updates to issue for entities with one or more singular attributes - for ( AttributeMapping attributeMapping : entityPersister.getAttributeMappings() ) { + final AttributeMappingsList attributeMappings = entityPersister.getAttributeMappings(); + for ( int i = 0; i < attributeMappings.size(); i++ ) { + AttributeMapping attributeMapping = attributeMappings.get( i ); if ( attributeMapping instanceof SingularAttributeMapping ) { return new ReactiveUpdateCoordinatorStandard( entityPersister, factory ); }