From b602c9bddffe452bf0b321e2ac95a3bd867096b5 Mon Sep 17 00:00:00 2001 From: Sanne Grinovero Date: Mon, 7 Aug 2023 18:13:53 +0200 Subject: [PATCH] HHH-17055 Remove deprecated method Value#getColumnIterator() --- .../dialect/temptable/TemporaryTable.java | 2 +- .../org/hibernate/id/ExportableColumn.java | 34 ---------------- .../org/hibernate/mapping/Collection.java | 5 --- .../java/org/hibernate/mapping/Component.java | 21 +++------- .../org/hibernate/mapping/Constraint.java | 5 --- .../hibernate/mapping/DenormalizedTable.java | 8 ---- .../java/org/hibernate/mapping/Index.java | 5 --- .../java/org/hibernate/mapping/OneToMany.java | 5 --- .../java/org/hibernate/mapping/OneToOne.java | 2 +- .../java/org/hibernate/mapping/Property.java | 8 ---- .../org/hibernate/mapping/SimpleValue.java | 7 +--- .../mapping/SingleTableSubclass.java | 2 +- .../java/org/hibernate/mapping/Table.java | 5 --- .../java/org/hibernate/mapping/Value.java | 6 --- .../DiscriminatedAssociationMapping.java | 2 +- .../internal/MappingModelCreationHelper.java | 2 +- .../internal/ToOneAttributeMapping.java | 31 +++++++------- .../BeanValidationDisabledTest.java | 2 +- .../DDLWithoutCallbackTest.java | 2 +- .../DefaultNamingCollectionElementTest.java | 2 +- .../nested/NestedEmbeddableMetadataTest.java | 2 +- ...dAccessedNestedEmbeddableMetadataTest.java | 2 +- .../orm/test/annotations/id/IdTest.java | 4 +- .../test/annotations/id/sequences/IdTest.java | 2 +- .../annotations/list/ListMappingTest.java | 2 +- .../ManyToManyImplicitNamingTest.java | 2 +- .../namingstrategy/NamingStrategyTest.java | 4 +- .../EmbeddedOverrideTests.java | 4 +- .../PluralEmbeddedOverrideTests.java | 2 +- .../test/component/basic/ComponentTest.java | 2 +- .../CompositeElementTest.java | 2 +- .../orm/test/constraint/ConstraintTest.java | 6 +-- .../NonRootTablePolymorphicTests.java | 2 +- .../namingstrategy/NamingStrategyTest.java | 6 +-- .../complete/BaseNamingTests.java | 40 +++++++++---------- ...cyJpaNamingWithAnnotationBindingTests.java | 4 +- .../LegacyJpaNamingWithHbmBindingTests.java | 4 +- ...ponentNamingStrategyForJoinColumnTest.java | 2 +- .../ComponentNamingStrategyTest.java | 4 +- .../namingstrategy/ejb3joincolumn/Tests.java | 10 ++--- .../quote/ColumnDefinitionQuotingTest.java | 26 +++++++----- .../ImprovedModifiedColumnNamingStrategy.java | 2 +- .../envers/boot/model/ColumnContainer.java | 7 ++-- .../envers/boot/model/DiscriminatorType.java | 2 +- .../org/hibernate/envers/boot/model/Join.java | 7 ++-- .../internal/ClassesAuditingData.java | 8 ++-- .../AbstractCollectionMetadataGenerator.java | 2 +- ...JoinColumnCollectionMetadataGenerator.java | 2 +- ...iddleTableCollectionMetadataGenerator.java | 2 +- .../ToOneRelationMetadataGenerator.java | 2 +- ...ionsJoinTableRangeComponentNamingTest.java | 6 +-- ...LongRevEntityInheritanceChildAuditing.java | 9 +++-- .../orm/test/envers/AbstractEnversTest.java | 7 ++-- .../ChildPrimaryKeyJoinAuditing.java | 2 +- .../DiscriminatorFormulaTest.java | 2 +- .../envers/integration/naming/JoinNaming.java | 2 +- .../naming/OneToManyUnidirectionalNaming.java | 2 +- .../naming/VersionsJoinTableNaming.java | 2 +- .../naming/ids/JoinEmbIdNaming.java | 4 +- .../naming/ids/JoinMulIdNaming.java | 4 +- .../naming/quotation/QuotedFieldsTest.java | 6 +-- 61 files changed, 135 insertions(+), 233 deletions(-) diff --git a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java index ff67a67fc4..ae1aaf6eea 100644 --- a/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java +++ b/hibernate-core/src/main/java/org/hibernate/dialect/temptable/TemporaryTable.java @@ -221,7 +221,7 @@ public class TemporaryTable implements Exportable, Contributable { .getEntityBinding( pluralAttribute.findContainingEntityMapping().getEntityName() ); final Property property = findPropertyByName( declaringClass, attributeName ); assert property != null; - final Iterator columnIterator = ( (Collection) property.getValue() ).getKey().getColumnIterator(); + final Iterator columnIterator = ( (Collection) property.getValue() ).getKey().getSelectables().iterator(); fkTarget.forEachSelectable( (columnIndex, selection) -> { final Selectable selectable = columnIterator.next(); diff --git a/hibernate-core/src/main/java/org/hibernate/id/ExportableColumn.java b/hibernate-core/src/main/java/org/hibernate/id/ExportableColumn.java index 7256075e99..554c11b553 100644 --- a/hibernate-core/src/main/java/org/hibernate/id/ExportableColumn.java +++ b/hibernate-core/src/main/java/org/hibernate/id/ExportableColumn.java @@ -6,9 +6,7 @@ */ package org.hibernate.id; -import java.util.Iterator; import java.util.List; -import java.util.NoSuchElementException; import org.hibernate.FetchMode; import org.hibernate.MappingException; @@ -76,11 +74,6 @@ public class ExportableColumn extends Column { return 1; } - @Override @Deprecated - public Iterator getColumnIterator() { - return new ColumnIterator( column ); - } - @Override public List getSelectables() { return List.of( column ); @@ -194,31 +187,4 @@ public class ExportableColumn extends Column { } } - public static class ColumnIterator implements Iterator { - private final ExportableColumn column; - private int count = 0; - - public ColumnIterator(ExportableColumn column) { - this.column = column; - } - - @Override - public boolean hasNext() { - return count == 0; - } - - @Override - public ExportableColumn next() { - if ( count > 0 ) { - throw new NoSuchElementException( "The single element has already been read" ); - } - count++; - return column; - } - - @Override - public void remove() { - throw new UnsupportedOperationException( "Cannot remove" ); - } - } } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java b/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java index 6d2564e535..e6752c7e17 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Collection.java @@ -407,11 +407,6 @@ public abstract class Collection implements Fetchable, Value, Filterable { } } - @Deprecated - public Iterator getColumnIterator() { - return Collections.emptyIterator(); - } - @Override public List getSelectables() { return Collections.emptyList(); diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java index b2525d8f7b..e32fac8527 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Component.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Component.java @@ -170,22 +170,6 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable throw new UnsupportedOperationException("Cant add a column to a component"); } - @Override - public int getColumnSpan() { - return getSelectables().size(); - } - - @Override @Deprecated @SuppressWarnings("deprecation") - public Iterator getColumnIterator() { - @SuppressWarnings("unchecked") - Iterator[] iters = new Iterator[ getPropertySpan() ]; - int i = 0; - for ( Property property : getProperties() ) { - iters[i++] = property.getColumnIterator(); - } - return new JoinedIterator<>( iters ); - } - @Override public List getSelectables() { if ( cachedSelectables == null ) { @@ -222,6 +206,11 @@ public class Component extends SimpleValue implements MetaAttributable, Sortable notifyPropertiesAboutAggregateColumn( aggregateColumn, this ); } + @Override + public int getColumnSpan() { + return getSelectables().size(); + } + public List getAggregatedColumns() { final List aggregatedColumns = new ArrayList<>( getPropertySpan() ); collectAggregatedColumns( aggregatedColumns, this ); diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java b/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java index 403e5e2b45..093f672af9 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Constraint.java @@ -140,11 +140,6 @@ public abstract class Constraint implements Exportable, Serializable { return columns.get( i ); } - @Deprecated(since = "6.0") - public Iterator getColumnIterator() { - return getColumns().iterator(); - } - public Table getTable() { return table; } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java b/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java index 093771480b..72507721d0 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/DenormalizedTable.java @@ -88,14 +88,6 @@ public class DenormalizedTable extends Table { return superColumn != null ? superColumn : includedTable.getColumn(name); } - @Override @Deprecated - public Iterator getColumnIterator() { - if ( reorderedColumns != null ) { - return reorderedColumns.iterator(); - } - return new JoinedIterator<>( includedTable.getColumnIterator(), super.getColumnIterator() ); - } - @Override public Collection getColumns() { if ( reorderedColumns != null ) { diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Index.java b/hibernate-core/src/main/java/org/hibernate/mapping/Index.java index dd1776e09e..e7ba069795 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Index.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Index.java @@ -105,11 +105,6 @@ public class Index implements Exportable, Serializable { return columns.size(); } - @Deprecated - public Iterator getColumnIterator() { - return getColumns().iterator(); - } - public java.util.List getColumns() { return unmodifiableList( columns ); } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java b/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java index 82c5aa5087..37a4a68a0d 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/OneToMany.java @@ -94,11 +94,6 @@ public class OneToMany implements Value { public void createUniqueKey() { } - @Deprecated - public Iterator getColumnIterator() { - return associatedClass.getKey().getColumnIterator(); - } - @Override public List getSelectables() { return associatedClass.getKey().getSelectables(); diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java b/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java index 605c1b84e1..bcd117da96 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/OneToOne.java @@ -119,7 +119,7 @@ public class OneToOne extends ToOne { @Override public Iterator getConstraintColumnIterator() { - return identifier.getColumnIterator(); + return identifier.getSelectables().iterator(); } /** diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Property.java b/hibernate-core/src/main/java/org/hibernate/mapping/Property.java index ac76167d22..d1ec2bc46a 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Property.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Property.java @@ -87,14 +87,6 @@ public class Property implements Serializable, MetaAttributable { return value.getColumnSpan(); } - /** - * @deprecated moving away from the use of {@link Iterator} as a return type - */ - @Deprecated(since = "6.0") - public Iterator getColumnIterator() { - return value.getColumnIterator(); - } - /** * Delegates to {@link Value#getSelectables()}. */ diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java index 401b47bf63..23464ef797 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SimpleValue.java @@ -266,11 +266,6 @@ public abstract class SimpleValue implements KeyValue { return columns.get( position ); } - @Override @Deprecated - public Iterator getColumnIterator() { - return columns.iterator(); - } - @Override public List getSelectables() { return columns; @@ -288,7 +283,7 @@ public abstract class SimpleValue implements KeyValue { } public Iterator getConstraintColumnIterator() { - return getColumnIterator(); + return getSelectables().iterator(); } public String getTypeName() { diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java b/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java index b049551c7c..417f0da4c6 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/SingleTableSubclass.java @@ -43,7 +43,7 @@ public class SingleTableSubclass extends Subclass { @Deprecated @SuppressWarnings("deprecation") protected Iterator getDiscriminatorColumnIterator() { return isDiscriminatorInsertable() && !getDiscriminator().hasFormula() - ? getDiscriminator().getColumnIterator() + ? getDiscriminator().getSelectables().iterator() : super.getDiscriminatorColumnIterator(); } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Table.java b/hibernate-core/src/main/java/org/hibernate/mapping/Table.java index b4bdfa6693..69f9611f73 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Table.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Table.java @@ -302,11 +302,6 @@ public class Table implements Serializable, ContributableDatabaseObject { return columns.size(); } - @Deprecated(since = "6.0") - public Iterator getColumnIterator() { - return getColumns().iterator(); - } - public Collection getColumns() { return columns.values(); } diff --git a/hibernate-core/src/main/java/org/hibernate/mapping/Value.java b/hibernate-core/src/main/java/org/hibernate/mapping/Value.java index 4f97eca497..c75d629da0 100644 --- a/hibernate-core/src/main/java/org/hibernate/mapping/Value.java +++ b/hibernate-core/src/main/java/org/hibernate/mapping/Value.java @@ -42,12 +42,6 @@ public interface Value extends Serializable { */ int getColumnSpan(); - /** - * @deprecated moving away from the use of {@link Iterator} as a return type - */ - @Deprecated(since = "6.0") - Iterator getColumnIterator(); - /** * The mapping to columns and formulas. */ diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/DiscriminatedAssociationMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/DiscriminatedAssociationMapping.java index fd87390664..85500909ad 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/DiscriminatedAssociationMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/DiscriminatedAssociationMapping.java @@ -68,7 +68,7 @@ public class DiscriminatedAssociationMapping implements MappingType, FetchOption ); assert bootValueMapping.getColumnSpan() == 2; - final Iterator columnIterator = bootValueMapping.getColumnIterator(); + final Iterator columnIterator = bootValueMapping.getSelectables().iterator(); assert columnIterator.hasNext(); final Selectable metaSelectable = columnIterator.next(); diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java index 5c28207012..87fae6d0e9 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/MappingModelCreationHelper.java @@ -916,7 +916,7 @@ public class MappingModelCreationHelper { if ( fkTarget instanceof BasicValuedModelPart ) { final BasicValuedModelPart simpleFkTarget = (BasicValuedModelPart) fkTarget; - final Iterator columnIterator = bootValueMapping.getColumnIterator(); + final Iterator columnIterator = bootValueMapping.getSelectables().iterator(); final Table table = bootValueMapping.getTable(); final String tableExpression = getTableIdentifierExpression( table, creationProcess ); final PropertyAccess declaringKeyPropertyAccess; diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java index 118ef6a9b9..a5f3f08ff2 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/ToOneAttributeMapping.java @@ -675,24 +675,21 @@ public class ToOneAttributeMapping } private static boolean equal(Value lhsValue, Value rhsValue) { - //noinspection deprecation - Iterator lhsColumns = lhsValue.getColumnIterator(); - //noinspection deprecation - Iterator rhsColumns = rhsValue.getColumnIterator(); - boolean hasNext; - do { - final Selectable lhs = lhsColumns.next(); - final Selectable rhs = rhsColumns.next(); - if ( !lhs.getText().equals( rhs.getText() ) ) { - return false; + List lhsColumns = lhsValue.getSelectables(); + List rhsColumns = rhsValue.getSelectables(); + if ( lhsColumns.size() != rhsColumns.size() ) { + return false; + } + else { + for ( int i=0; i selectables = component.getColumnIterator(); + Iterator selectables = component.getSelectables().iterator(); int pass = 1; while ( selectables.hasNext() ) { final Column column = assertTyping( Column.class, selectables.next() ); @@ -156,7 +156,7 @@ public class LegacyJpaNamingWithAnnotationBindingTests extends BaseAnnotationBin @Override protected void validateCustomerAddressesElementComponent(Component component) { assertEquals( 3, component.getColumnSpan() ); - Iterator selectables = component.getColumnIterator(); + Iterator selectables = component.getSelectables().iterator(); int pass = 1; while ( selectables.hasNext() ) { final Column column = assertTyping( Column.class, selectables.next() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/complete/LegacyJpaNamingWithHbmBindingTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/complete/LegacyJpaNamingWithHbmBindingTests.java index d40f064675..d837eac14e 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/complete/LegacyJpaNamingWithHbmBindingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/complete/LegacyJpaNamingWithHbmBindingTests.java @@ -58,7 +58,7 @@ public class LegacyJpaNamingWithHbmBindingTests extends BaseHbmBindingTests { @Override protected void validateCustomerHqAddressComponent(Component component) { assertEquals( 3, component.getColumnSpan() ); - Iterator selectables = component.getColumnIterator(); + Iterator selectables = component.getSelectables().iterator(); int pass = 1; while ( selectables.hasNext() ) { final Column column = assertTyping( Column.class, selectables.next() ); @@ -158,7 +158,7 @@ public class LegacyJpaNamingWithHbmBindingTests extends BaseHbmBindingTests { @Override protected void validateCustomerAddressesElementComponent(Component component) { assertEquals( 3, component.getColumnSpan() ); - Iterator selectables = component.getColumnIterator(); + Iterator selectables = component.getSelectables().iterator(); int pass = 1; while ( selectables.hasNext() ) { final Column column = assertTyping( Column.class, selectables.next() ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyForJoinColumnTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyForJoinColumnTest.java index 3b18acad29..b3802eb614 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyForJoinColumnTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyForJoinColumnTest.java @@ -95,7 +95,7 @@ public class ComponentNamingStrategyForJoinColumnTest { assertEquals( 1, collection.getOwner().getKey().getColumnSpan() ); assertEquals( ownerForeignKeyNameExpected, - collection.getKey().getColumnIterator().next().getText() + collection.getKey().getSelectables().get( 0 ).getText() ); int columnNumber = table.getColumnSpan(); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyTest.java index 1020331937..0704310480 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/components/ComponentNamingStrategyTest.java @@ -53,7 +53,7 @@ public class ComponentNamingStrategyTest { Bag value = assertTyping( Bag.class, p.getValue() ); SimpleValue elementValue = assertTyping( SimpleValue.class, value.getElement() ); assertEquals( 1, elementValue.getColumnSpan() ); - Column column = assertTyping( Column.class, elementValue.getColumnIterator().next() ); + Column column = assertTyping( Column.class, elementValue.getSelectables().get( 0 ) ); assertEquals( column.getName(), "name" ); } finally { @@ -81,7 +81,7 @@ public class ComponentNamingStrategyTest { Bag value = assertTyping( Bag.class, p.getValue() ); SimpleValue elementValue = assertTyping( SimpleValue.class, value.getElement() ); assertEquals( 1, elementValue.getColumnSpan() ); - Column column = assertTyping( Column.class, elementValue.getColumnIterator().next() ); + Column column = assertTyping( Column.class, elementValue.getSelectables().get( 0 ) ); assertEquals( "items_name", column.getName() ); } finally { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/ejb3joincolumn/Tests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/ejb3joincolumn/Tests.java index a63bcf02b3..1c3595ced2 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/ejb3joincolumn/Tests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/namingstrategy/ejb3joincolumn/Tests.java @@ -7,6 +7,7 @@ package org.hibernate.orm.test.namingstrategy.ejb3joincolumn; import java.util.Iterator; +import java.util.List; import java.util.Locale; import org.hibernate.boot.Metadata; @@ -21,13 +22,13 @@ import org.hibernate.cfg.Environment; import org.hibernate.mapping.Column; import org.hibernate.mapping.PersistentClass; import org.hibernate.mapping.Property; +import org.hibernate.mapping.Selectable; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.BaseUnitTest; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertTrue; /** @@ -60,10 +61,9 @@ public class Tests { final PersistentClass languageBinding = metadata.getEntityBinding( Language.class.getName() ); final Property property = languageBinding.getProperty( "fallBack" ); - Iterator itr = property.getValue().getColumnIterator(); - assertTrue( itr.hasNext() ); - final Column column = (Column) itr.next(); - assertFalse( itr.hasNext() ); + List selectables = property.getValue().getSelectables(); + assertTrue( selectables.size() == 1 ); + final Column column = (Column) selectables.get( 0 ); assertEquals( "C_FALLBACK_ID", column.getName().toUpperCase( Locale.ROOT ) ); } diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/quote/ColumnDefinitionQuotingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/quote/ColumnDefinitionQuotingTest.java index 50d207a0b6..78821f68ca 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/quote/ColumnDefinitionQuotingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/quote/ColumnDefinitionQuotingTest.java @@ -6,7 +6,8 @@ */ package org.hibernate.orm.test.quote; -import java.util.Iterator; +import java.util.List; + import jakarta.persistence.Column; import jakarta.persistence.Entity; import jakarta.persistence.Id; @@ -21,9 +22,11 @@ import org.hibernate.cfg.AvailableSettings; import org.hibernate.dialect.Dialect; import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment; import org.hibernate.mapping.PersistentClass; +import org.hibernate.mapping.Selectable; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.orm.junit.BaseUnitTest; +import org.junit.Assert; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -51,10 +54,10 @@ public class ColumnDefinitionQuotingTest { PersistentClass entityBinding = metadata.getEntityBinding( E1.class.getName() ); - org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getColumnIterator() ); + org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getSelectables() ); assertTrue( isQuoted( idColumn.getSqlType(), ssr ) ); - org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getColumnIterator() ); + org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getSelectables() ); assertTrue( isQuoted( otherColumn.getSqlType(), ssr ) ); } } @@ -78,18 +81,19 @@ public class ColumnDefinitionQuotingTest { PersistentClass entityBinding = metadata.getEntityBinding( E1.class.getName() ); - org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getColumnIterator() ); + org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getSelectables() ); assertTrue( isQuoted( idColumn.getSqlType(), ssr ) ); - org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getColumnIterator() ); + org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getSelectables() ); assertTrue( isQuoted( otherColumn.getSqlType(), ssr ) ); } } ); } - private org.hibernate.mapping.Column extractColumn(Iterator columnIterator) { - return (org.hibernate.mapping.Column) columnIterator.next(); + private org.hibernate.mapping.Column extractColumn(List columns) { + Assert.assertEquals( 1, columns.size() ); + return (org.hibernate.mapping.Column) columns.get( 0 ); } private boolean isQuoted(String sqlType, StandardServiceRegistry ssr) { @@ -115,10 +119,10 @@ public class ColumnDefinitionQuotingTest { PersistentClass entityBinding = metadata.getEntityBinding( E2.class.getName() ); - org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getColumnIterator() ); + org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getSelectables() ); assertTrue( isQuoted( idColumn.getSqlType(), ssr ) ); - org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getColumnIterator() ); + org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getSelectables() ); assertTrue( isQuoted( otherColumn.getSqlType(), ssr ) ); } } @@ -142,10 +146,10 @@ public class ColumnDefinitionQuotingTest { PersistentClass entityBinding = metadata.getEntityBinding( E2.class.getName() ); - org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getColumnIterator() ); + org.hibernate.mapping.Column idColumn = extractColumn( entityBinding.getIdentifier().getSelectables() ); assertTrue( !isQuoted( idColumn.getSqlType(), ssr ) ); - org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getColumnIterator() ); + org.hibernate.mapping.Column otherColumn = extractColumn( entityBinding.getProperty( "other" ).getSelectables() ); assertTrue( !isQuoted( otherColumn.getSqlType(), ssr ) ); } } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java index 38defa17f2..0279bc6049 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/internal/ImprovedModifiedColumnNamingStrategy.java @@ -42,7 +42,7 @@ public class ImprovedModifiedColumnNamingStrategy extends LegacyModifiedColumnNa if ( basicType || toOneType ) { if ( value.getColumnSpan() == 1 ) { - Selectable selectable = value.getColumnIterator().next(); + Selectable selectable = value.getSelectables().get( 0 ); if ( selectable instanceof Column ) { // This should not be applied for formulas final String columnName; diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/ColumnContainer.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/ColumnContainer.java index d716cf33b3..1ed102d7b4 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/ColumnContainer.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/ColumnContainer.java @@ -6,7 +6,6 @@ */ package org.hibernate.envers.boot.model; -import java.util.Iterator; import java.util.List; import org.hibernate.mapping.Selectable; @@ -38,9 +37,9 @@ public interface ColumnContainer { * @param value the value mapping */ default void addColumnsFromValue(Value value) { - final Iterator iterator = value.getColumnIterator(); - while ( iterator.hasNext() ) { - addColumn( Column.from( iterator.next() ) ); + final List selectables = value.getSelectables(); + for ( Selectable s : selectables ) { + addColumn( Column.from( s ) ); } } } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/DiscriminatorType.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/DiscriminatorType.java index 1f089a13d7..8e322a5dfd 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/DiscriminatorType.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/DiscriminatorType.java @@ -30,7 +30,7 @@ public class DiscriminatorType implements Bindable iterator = discriminator.getColumnIterator(); + final Iterator iterator = discriminator.getSelectables().iterator(); while ( iterator.hasNext() ) { final Selectable selectable = iterator.next(); if ( selectable.isFormula() ) { diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/Join.java b/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/Join.java index 855d5e3a73..419ada0d78 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/Join.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/boot/model/Join.java @@ -7,7 +7,6 @@ package org.hibernate.envers.boot.model; import java.util.ArrayList; -import java.util.Iterator; import java.util.List; import org.hibernate.boot.jaxb.hbm.spi.JaxbHbmKeyType; @@ -70,9 +69,9 @@ public class Join implements AttributeContainer, Bindable iterator = value.getColumnIterator(); - while ( iterator.hasNext() ) { - keyColumns.add( Column.from( iterator.next() ) ); + final List selectables = value.getSelectables(); + for ( Selectable s : selectables ) { + keyColumns.add( Column.from( s ) ); } } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/ClassesAuditingData.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/ClassesAuditingData.java index 05f34aef87..a108be43a1 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/ClassesAuditingData.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/ClassesAuditingData.java @@ -147,8 +147,8 @@ public class ClassesAuditingData { private void addSyntheticIndexProperty(List value, String propertyAccessorName, ClassAuditingData classAuditingData) { final Value indexValue = value.getIndex(); - if ( indexValue != null && indexValue.getColumnIterator().hasNext() ) { - final String indexColumnName = indexValue.getColumnIterator().next().getText(); + if ( indexValue != null && indexValue.getSelectables().size() > 0 ) { + final String indexColumnName = indexValue.getSelectables().get( 0 ).getText(); if ( indexColumnName != null ) { final PropertyAuditingData auditingData = new PropertyAuditingData( indexColumnName, @@ -166,8 +166,8 @@ public class ClassesAuditingData { private void addMapEnumeratedKey(Value value, String propertyAccessorName, ClassAuditingData classAuditingData) { if ( value instanceof org.hibernate.mapping.Map ) { final Value indexValue = ( (org.hibernate.mapping.Map) value ).getIndex(); - if ( indexValue != null && indexValue.getColumnIterator().hasNext() ) { - final String indexColumnName = indexValue.getColumnIterator().next().getText(); + if ( indexValue != null && indexValue.getSelectables().size() > 0 ) { + final String indexColumnName = indexValue.getSelectables().get( 0 ).getText(); if ( !StringTools.isEmpty( indexColumnName ) ) { final PropertyAuditingData propertyAuditingData = new PropertyAuditingData( indexColumnName, diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java index 9720b678a7..770dddf2be 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/AbstractCollectionMetadataGenerator.java @@ -279,7 +279,7 @@ public abstract class AbstractCollectionMetadataGenerator extends AbstractMetada columnNameIterator = joinTableData.getInverseJoinColumnNamesIterator(); } else { - columnNameIterator = ColumnNameIterator.from( value.getColumnIterator() ); + columnNameIterator = ColumnNameIterator.from( value.getSelectables().iterator() ); } addAttributesToEntity( diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java index a0cc2b7426..ce11bc7662 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/JoinColumnCollectionMetadataGenerator.java @@ -209,7 +209,7 @@ public class JoinColumnCollectionMetadataGenerator extends AbstractCollectionMet return context.getPropertyAuditingData().getPositionMappedBy(); } else if ( hasCollectionIndex( context ) ) { - return ( (IndexedCollection) context.getCollection() ).getIndex().getColumnIterator().next().getText(); + return ( (IndexedCollection) context.getCollection() ).getIndex().getSelectables().get( 0 ).getText(); } return null; } diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/MiddleTableCollectionMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/MiddleTableCollectionMetadataGenerator.java index 33ecba26a4..95ebb85471 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/MiddleTableCollectionMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/MiddleTableCollectionMetadataGenerator.java @@ -143,7 +143,7 @@ public class MiddleTableCollectionMetadataGenerator extends AbstractCollectionMe middleEntity, getPrefixedIdAttributes( referencingPrefixRelated, - ColumnNameIterator.from( context.getCollection().getKey().getColumnIterator() ), + ColumnNameIterator.from( context.getCollection().getKey().getSelectables().iterator() ), referencingIdMapping ) ); diff --git a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/ToOneRelationMetadataGenerator.java b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/ToOneRelationMetadataGenerator.java index 8ac6392dd8..7d7df2aaf5 100644 --- a/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/ToOneRelationMetadataGenerator.java +++ b/hibernate-envers/src/main/java/org/hibernate/envers/configuration/internal/metadata/ToOneRelationMetadataGenerator.java @@ -85,7 +85,7 @@ public final class ToOneRelationMetadataGenerator extends AbstractMetadataGenera // Adding an element to the mapping corresponding to the references entity id's idMapping.getRelation() - .getAttributesPrefixed( lastPropertyPrefix, value.getColumnIterator(), false, insertable ) + .getAttributesPrefixed( lastPropertyPrefix, value.getSelectables().iterator(), false, insertable ) .forEach( mapping::addAttribute ); boolean lazy = ( (ToOne) value ).isLazy(); diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java index 45b892168d..ef506e9f5b 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/naming/VersionsJoinTableRangeComponentNamingTest.java @@ -231,7 +231,7 @@ public class VersionsJoinTableRangeComponentNamingTest extends assert auditClass != null; @SuppressWarnings("unchecked") - Iterator columns = auditClass.getTable().getColumnIterator(); + Iterator columns = auditClass.getTable().getColumns().iterator(); boolean id1Found = false; boolean id2Found = false; @@ -258,7 +258,7 @@ public class VersionsJoinTableRangeComponentNamingTest extends assert auditClass != null; @SuppressWarnings("unchecked") - Iterator columns = auditClass.getTable().getColumnIterator(); + Iterator columns = auditClass.getTable().getColumns().iterator(); boolean id1Found = false; boolean id2Found = false; @@ -291,7 +291,7 @@ public class VersionsJoinTableRangeComponentNamingTest extends assert auditClass != null; @SuppressWarnings("unchecked") - Iterator columns = auditClass.getTable().getColumnIterator(); + Iterator columns = auditClass.getTable().getColumns().iterator(); boolean auditColumn1Found = false; boolean auditColumn2Found = false; diff --git a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java index 75d2a619ea..75109f0ee8 100644 --- a/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java +++ b/hibernate-envers/src/test/java/org/hibernate/envers/test/integration/reventity/LongRevEntityInheritanceChildAuditing.java @@ -8,6 +8,7 @@ package org.hibernate.envers.test.integration.reventity; import java.util.Iterator; +import java.util.List; import org.hibernate.mapping.Selectable; import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase; @@ -37,14 +38,14 @@ public class LongRevEntityInheritanceChildAuditing extends BaseEnversJPAFunction public void testChildRevColumnType() { // Hibernate now sorts columns that are part of the key and therefore this test needs to test // for the existence of the specific key column rather than the expectation that is exists at - // a specific order in the iterator. - Iterator childEntityKeyColumnsIterator = metadata() + // a specific order. + List childEntityKeyColumns = metadata() .getEntityBinding( ChildEntity.class.getName() + "_AUD" ) .getKey() - .getColumnIterator(); + .getSelectables(); final String revisionColumnName = getConfiguration().getRevisionFieldName(); - Column column = getColumnFromIteratorByName( childEntityKeyColumnsIterator, revisionColumnName ); + Column column = getColumnFromIteratorByName( childEntityKeyColumns, revisionColumnName ); assertNotNull( column ); assertEquals( column.getSqlType(), "int" ); } diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/AbstractEnversTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/AbstractEnversTest.java index 2114ba96c0..bb9d0e4fd4 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/AbstractEnversTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/AbstractEnversTest.java @@ -7,7 +7,6 @@ package org.hibernate.orm.test.envers; import java.util.Arrays; -import java.util.Iterator; import java.util.List; import org.hibernate.testing.cleaner.DatabaseCleaner; @@ -51,9 +50,9 @@ public abstract class AbstractEnversTest { return auditStrategy; } - protected Column getColumnFromIteratorByName(Iterator iterator, String columnName) { - while ( iterator.hasNext() ) { - Column column = (Column) iterator.next(); + protected Column getColumnFromIteratorByName(List selectables, String columnName) { + for ( Selectable s : selectables ) { + Column column = (Column) s; if ( column.getName().equals( columnName) ) { return column; } diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java index f17970f2a0..7a1a59002d 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/joined/primarykeyjoin/ChildPrimaryKeyJoinAuditing.java @@ -87,6 +87,6 @@ public class ChildPrimaryKeyJoinAuditing extends BaseEnversJPAFunctionalTestCase // for the existence of the specific key column rather than the expectation that is exists at // a specific order in the iterator. final PersistentClass persistentClass = metadata().getEntityBinding( ChildPrimaryKeyJoinEntity.class.getName() + "_AUD" ); - Assert.assertNotNull( getColumnFromIteratorByName( persistentClass.getKey().getColumnIterator(), "other_id" ) ); + Assert.assertNotNull( getColumnFromIteratorByName( persistentClass.getKey().getSelectables(), "other_id" ) ); } } diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java index 3d18b12d27..5e39e5a809 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/inheritance/single/discriminatorformula/DiscriminatorFormulaTest.java @@ -94,7 +94,7 @@ public class DiscriminatorFormulaTest extends BaseEnversJPAFunctionalTestCase { @Test public void testDiscriminatorFormulaInAuditTable() { assert parentAudit.getDiscriminator().hasFormula(); - Iterator iterator = parentAudit.getDiscriminator().getColumnIterator(); + Iterator iterator = parentAudit.getDiscriminator().getSelectables().iterator(); while ( iterator.hasNext() ) { Object o = iterator.next(); if ( o instanceof Formula ) { diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/JoinNaming.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/JoinNaming.java index b03b5ad223..bf5f9f130c 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/JoinNaming.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/JoinNaming.java @@ -113,7 +113,7 @@ public class JoinNaming extends BaseEnversJPAFunctionalTestCase { public void testJoinColumnName() { Iterator columns = metadata().getEntityBinding( "org.hibernate.orm.test.envers.integration.naming.JoinNamingRefIngEntity_AUD" - ).getProperty( "reference_id" ).getColumnIterator(); + ).getProperty( "reference_id" ).getSelectables().iterator(); assertTrue( columns.hasNext() ); assertEquals( "jnree_column_reference", columns.next().getText() ); assertFalse( columns.hasNext() ); diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/OneToManyUnidirectionalNaming.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/OneToManyUnidirectionalNaming.java index 936551a8f8..6a9f3c0448 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/OneToManyUnidirectionalNaming.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/OneToManyUnidirectionalNaming.java @@ -95,7 +95,7 @@ public class OneToManyUnidirectionalNaming extends BaseEnversJPAFunctionalTestCa @Test public void testJoinColumnName() { Iterator columns = - metadata().getEntityBinding( MIDDLE_VERSIONS_ENTITY_NAME ).getTable().getColumnIterator(); + metadata().getEntityBinding( MIDDLE_VERSIONS_ENTITY_NAME ).getTable().getColumns().iterator(); boolean id1Found = false; boolean id2Found = false; diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/VersionsJoinTableNaming.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/VersionsJoinTableNaming.java index febf97689e..d954c7e82d 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/VersionsJoinTableNaming.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/VersionsJoinTableNaming.java @@ -100,7 +100,7 @@ public class VersionsJoinTableNaming extends BaseEnversJPAFunctionalTestCase { @Test public void testJoinColumnName() { Iterator columns = - metadata().getEntityBinding( MIDDLE_VERSIONS_ENTITY_NAME ).getTable().getColumnIterator(); + metadata().getEntityBinding( MIDDLE_VERSIONS_ENTITY_NAME ).getTable().getColumns().iterator(); boolean id1Found = false; boolean id2Found = false; diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinEmbIdNaming.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinEmbIdNaming.java index 8f241f0dbd..c75c99f2b0 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinEmbIdNaming.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinEmbIdNaming.java @@ -126,7 +126,7 @@ public class JoinEmbIdNaming extends BaseEnversJPAFunctionalTestCase { public void testJoinColumnNames() { Iterator columns = metadata().getEntityBinding( "org.hibernate.orm.test.envers.integration.naming.ids.JoinEmbIdNamingRefIngEntity_AUD" - ).getProperty( "reference_x" ).getColumnIterator(); + ).getProperty( "reference_x" ).getSelectables().iterator(); assertTrue( columns.hasNext() ); assertEquals( "XX_reference", columns.next().getText() ); @@ -134,7 +134,7 @@ public class JoinEmbIdNaming extends BaseEnversJPAFunctionalTestCase { columns = metadata().getEntityBinding( "org.hibernate.orm.test.envers.integration.naming.ids.JoinEmbIdNamingRefIngEntity_AUD" - ).getProperty( "reference_y" ).getColumnIterator(); + ).getProperty( "reference_y" ).getSelectables().iterator(); assertTrue( columns.hasNext() ); assertEquals( "YY_reference", columns.next().getText() ); diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinMulIdNaming.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinMulIdNaming.java index 463832b364..b1e55790d5 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinMulIdNaming.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/ids/JoinMulIdNaming.java @@ -126,7 +126,7 @@ public class JoinMulIdNaming extends BaseEnversJPAFunctionalTestCase { public void testJoinColumnNames() { Iterator columns = metadata().getEntityBinding( "org.hibernate.orm.test.envers.integration.naming.ids.JoinMulIdNamingRefIngEntity_AUD" - ).getProperty( "reference_id1" ).getColumnIterator(); + ).getProperty( "reference_id1" ).getSelectables().iterator(); assertTrue( columns.hasNext() ); assertEquals( "ID1_reference", columns.next().getText() ); @@ -134,7 +134,7 @@ public class JoinMulIdNaming extends BaseEnversJPAFunctionalTestCase { columns = metadata().getEntityBinding( "org.hibernate.orm.test.envers.integration.naming.ids.JoinMulIdNamingRefIngEntity_AUD" - ).getProperty( "reference_id2" ).getColumnIterator(); + ).getProperty( "reference_id2" ).getSelectables().iterator(); assertTrue( columns.hasNext() ); assertEquals( "ID2_reference", columns.next().getText() ); diff --git a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/quotation/QuotedFieldsTest.java b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/quotation/QuotedFieldsTest.java index 466ce36c79..35ceb3c982 100644 --- a/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/quotation/QuotedFieldsTest.java +++ b/hibernate-envers/src/test/java/org/hibernate/orm/test/envers/integration/naming/quotation/QuotedFieldsTest.java @@ -7,6 +7,7 @@ package org.hibernate.orm.test.envers.integration.naming.quotation; import java.util.Arrays; +import java.util.Collection; import java.util.Iterator; import jakarta.persistence.EntityManager; @@ -101,9 +102,8 @@ public class QuotedFieldsTest extends BaseEnversJPAFunctionalTestCase { } private Column getColumnByName(Table table, String columnName) { - Iterator columnIterator = table.getColumnIterator(); - while ( columnIterator.hasNext() ) { - Column column = columnIterator.next(); + Collection columns = table.getColumns(); + for ( Column column : columns ) { if ( columnName.equals( column.getName() ) ) { return column; }