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 989dfa5a89..56bd1598f5 100644
--- a/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java
+++ b/hibernate-core/src/main/java/org/hibernate/mapping/PersistentClass.java
@@ -29,7 +29,6 @@ import org.hibernate.dialect.Dialect;
import org.hibernate.engine.OptimisticLockStyle;
import org.hibernate.engine.spi.ExecuteUpdateResultCheckStyle;
import org.hibernate.internal.FilterConfiguration;
-import org.hibernate.internal.util.collections.JoinedIterator;
import org.hibernate.internal.util.collections.JoinedList;
import org.hibernate.metamodel.spi.RuntimeModelCreationContext;
import org.hibernate.persister.entity.EntityPersister;
@@ -756,30 +755,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
return 0;
}
- /**
- * Build an iterator over the properties defined on this class. The returned
- * iterator only accounts for "normal" properties (i.e. non-identifier
- * properties).
- *
- * Differs from {@link #getUnjoinedProperties()} (followed by iterator()) in that the returned iterator
- * will include properties defined as part of a join.
- *
- * The properties defined in superclasses of the mapping inheritance are not included.
- *
- * @return An iterator over the "normal" properties.
- *
- * @deprecated use {@link #getProperties()}
- */
- @Deprecated(since = "6.0")
- public Iterator getPropertyIterator() {
- final ArrayList> iterators = new ArrayList<>();
- iterators.add( properties.iterator() );
- for ( Join join : joins ) {
- iterators.add( join.getPropertyIterator() );
- }
- return new JoinedIterator<>( iterators );
- }
-
/**
* Build a list of the properties defined on this class. The returned
* iterator only accounts for "normal" properties (i.e. non-identifier
@@ -1076,9 +1051,9 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
}
private boolean determineIfNaturalIdDefined() {
- final Iterator props = getRootClass().getPropertyIterator();
- while ( props.hasNext() ) {
- if ( props.next().isNaturalIdentifier() ) {
+ final List props = getRootClass().getProperties();
+ for ( Property p : props ) {
+ if ( p.isNaturalIdentifier() ) {
return true;
}
}
diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/SimpleEntityTypeResolutionsTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/SimpleEntityTypeResolutionsTests.java
index d303a4cb17..f539fd1239 100644
--- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/SimpleEntityTypeResolutionsTests.java
+++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/binding/annotations/basics/SimpleEntityTypeResolutionsTests.java
@@ -49,7 +49,7 @@ public class SimpleEntityTypeResolutionsTests {
assertThat( resolution.getJdbcMapping(), sameInstance( resolution.getLegacyResolvedBasicType() ) );
}
- final Iterator itr = simpleEntityBinding.getPropertyIterator();
+ final Iterator itr = simpleEntityBinding.getProperties().iterator();
while ( itr.hasNext() ) {
final Property property = itr.next();
final BasicValue propertyValue = (BasicValue) property.getValue();
diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/NonReflectiveBinderTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/NonReflectiveBinderTest.java
index 7eacae5ab4..8bdd4a0745 100644
--- a/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/NonReflectiveBinderTest.java
+++ b/hibernate-core/src/test/java/org/hibernate/orm/test/legacy/NonReflectiveBinderTest.java
@@ -75,7 +75,7 @@ public class NonReflectiveBinderTest {
/*Property property = cm.getIdentifierProperty();
property.getMetaAttribute(null);*/
- Iterator propertyIterator = cm.getPropertyIterator();
+ Iterator propertyIterator = cm.getProperties().iterator();
while ( propertyIterator.hasNext() ) {
Property element = propertyIterator.next();
Map ma = element.getMetaAttributes();
diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/CollectionMappedByResolver.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/CollectionMappedByResolver.java
index b1002cd29e..e779c9b92a 100644
--- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/CollectionMappedByResolver.java
+++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/CollectionMappedByResolver.java
@@ -105,10 +105,8 @@ public class CollectionMappedByResolver {
}
private static String searchMappedBy(PersistentClass referencedClass, Collection collectionValue) {
- final Iterator assocClassProps = referencedClass.getPropertyIterator();
- while ( assocClassProps.hasNext() ) {
- final Property property = assocClassProps.next();
-
+ final List assocClassProps = referencedClass.getProperties();
+ for ( Property property : assocClassProps ) {
final List assocClassSelectables = property.getValue().getSelectables();
final List collectionKeySelectables = collectionValue.getKey().getSelectables();
if ( Objects.equals( assocClassSelectables, collectionKeySelectables ) ) {
diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/properties/UnversionedOptimisticLockingField.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/properties/UnversionedOptimisticLockingField.java
index 3b5dd2ba52..6bee805df5 100644
--- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/properties/UnversionedOptimisticLockingField.java
+++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/properties/UnversionedOptimisticLockingField.java
@@ -7,7 +7,6 @@
package org.hibernate.orm.test.envers.integration.properties;
import java.util.Arrays;
-import java.util.Iterator;
import java.util.Map;
import jakarta.persistence.EntityManager;
@@ -17,6 +16,7 @@ import org.hibernate.orm.test.envers.Priority;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.Property;
+import org.junit.Assert;
import org.junit.Test;
/**
@@ -76,10 +76,8 @@ public class UnversionedOptimisticLockingField extends BaseEnversJPAFunctionalTe
@Test
public void testMapping() {
PersistentClass pc = metadata().getEntityBinding( UnversionedOptimisticLockingFieldEntity.class.getName() + "_AUD" );
- Iterator pi = pc.getPropertyIterator();
- while ( pi.hasNext() ) {
- Property p = (Property) pi.next();
- assert !"optLocking".equals( p.getName() );
+ for ( Property p : pc.getProperties() ) {
+ Assert.assertNotEquals( "optLocking", p.getName() );
}
}
}
diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/tools/TestTools.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/tools/TestTools.java
index 4445e45e4a..8f014b0e87 100644
--- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/tools/TestTools.java
+++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/tools/TestTools.java
@@ -74,10 +74,9 @@ public class TestTools {
}
public static Set extractModProperties(PersistentClass persistentClass, String suffix) {
- final Set result = new HashSet();
- final Iterator iterator = persistentClass.getPropertyIterator();
- while ( iterator.hasNext() ) {
- final Property property = (Property) iterator.next();
+ final Set result = new HashSet<>();
+ final List props = persistentClass.getProperties();
+ for ( Property property : props ) {
final String propertyName = property.getName();
if ( propertyName.endsWith( suffix ) ) {
result.add( propertyName );