HHH-17061 Remove deprecated method PersistentClass#getJoinIterator

This commit is contained in:
Sanne Grinovero 2023-08-09 16:02:48 +02:00 committed by Sanne Grinovero
parent 6970ddbbbf
commit aea84e3fdc
8 changed files with 26 additions and 40 deletions

View File

@ -720,11 +720,6 @@ public abstract class PersistentClass implements IdentifiableTypeClass, Attribut
return joins; return joins;
} }
@Deprecated(since = "6.0")
public Iterator<Join> getJoinIterator() {
return joins.iterator();
}
public void addJoin(Join join) { public void addJoin(Join join) {
if ( !joins.contains(join) ) { if ( !joins.contains(join) ) {
joins.add( join ); joins.add( join );

View File

@ -79,7 +79,7 @@ public abstract class AbstractJPAIndexTest extends BaseNonConfigCoreFunctionalTe
public void testSecondaryTableIndex(){ public void testSecondaryTableIndex(){
PersistentClass entity = metadata().getEntityBinding( Car.class.getName() ); PersistentClass entity = metadata().getEntityBinding( Car.class.getName() );
Join join = (Join)entity.getJoinIterator().next(); Join join = entity.getJoins().get( 0 );
Iterator<Index> itr = join.getTable().getIndexes().values().iterator(); Iterator<Index> itr = join.getTable().getIndexes().values().iterator();
assertTrue( itr.hasNext() ); assertTrue( itr.hasNext() );
Index index = itr.next(); Index index = itr.next();

View File

@ -308,8 +308,7 @@ public class OneToOneTest extends BaseNonConfigCoreFunctionalTestCase {
@TestForIssue( jiraKey = "HHH-4606" ) @TestForIssue( jiraKey = "HHH-4606" )
public void testJoinColumnConfiguredInXml() { public void testJoinColumnConfiguredInXml() {
PersistentClass pc = metadata().getEntityBinding( Son.class.getName() ); PersistentClass pc = metadata().getEntityBinding( Son.class.getName() );
Iterator<Join> iter = pc.getJoinIterator(); Table table = pc.getJoins().get( 0 ).getTable();
Table table = iter.next().getTable();
Iterator<Column> columnIter = table.getColumns().iterator(); Iterator<Column> columnIter = table.getColumns().iterator();
boolean fooFound = false; boolean fooFound = false;
boolean barFound = false; boolean barFound = false;

View File

@ -144,7 +144,7 @@ public final class AuditMetadataGenerator extends AbstractMetadataGenerator {
} }
private void createJoins(PersistentClass persistentClass, JoinAwarePersistentEntity entity, ClassAuditingData auditingData) { private void createJoins(PersistentClass persistentClass, JoinAwarePersistentEntity entity, ClassAuditingData auditingData) {
final Iterator<org.hibernate.mapping.Join> joins = persistentClass.getJoinIterator(); final Iterator<org.hibernate.mapping.Join> joins = persistentClass.getJoins().iterator();
final Map<org.hibernate.mapping.Join, Join> joinElements = new HashMap<>(); final Map<org.hibernate.mapping.Join, Join> joinElements = new HashMap<>();
entityJoins.put( persistentClass.getEntityName(), joinElements ); entityJoins.put( persistentClass.getEntityName(), joinElements );
@ -196,7 +196,7 @@ public final class AuditMetadataGenerator extends AbstractMetadataGenerator {
String entityName, String entityName,
EntityMappingData mappingData, EntityMappingData mappingData,
boolean firstPass) { boolean firstPass) {
final Iterator<org.hibernate.mapping.Join> joins = persistentClass.getJoinIterator(); final Iterator<org.hibernate.mapping.Join> joins = persistentClass.getJoins().iterator();
while ( joins.hasNext() ) { while ( joins.hasNext() ) {
final org.hibernate.mapping.Join join = joins.next(); final org.hibernate.mapping.Join join = joins.next();

View File

@ -14,6 +14,7 @@ import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase;
import org.hibernate.orm.test.envers.Priority; import org.hibernate.orm.test.envers.Priority;
import org.hibernate.mapping.Join; import org.hibernate.mapping.Join;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
@ -71,13 +72,11 @@ public class BasicSecondary extends BaseEnversJPAFunctionalTestCase {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void testTableNames() { public void testTableNames() {
assert "secondary_AUD".equals( Assert.assertEquals("secondary_AUD",
((Iterator<Join>)
metadata().getEntityBinding( metadata().getEntityBinding(
"org.hibernate.orm.test.envers.integration.secondary.SecondaryTestEntity_AUD" "org.hibernate.orm.test.envers.integration.secondary.SecondaryTestEntity_AUD"
) )
.getJoinIterator()) .getJoins().get( 0 ).getTable().getName()
.next().getTable().getName()
); );
} }
} }

View File

@ -7,13 +7,12 @@
package org.hibernate.orm.test.envers.integration.secondary; package org.hibernate.orm.test.envers.integration.secondary;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase; import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase;
import org.hibernate.orm.test.envers.Priority; import org.hibernate.orm.test.envers.Priority;
import org.hibernate.mapping.Join;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
@ -71,13 +70,11 @@ public class NamingSecondary extends BaseEnversJPAFunctionalTestCase {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void testTableNames() { public void testTableNames() {
assert "sec_versions".equals( Assert.assertEquals( "sec_versions",
((Iterator<Join>)
metadata().getEntityBinding( metadata().getEntityBinding(
"org.hibernate.orm.test.envers.integration.secondary.SecondaryNamingTestEntity_AUD" "org.hibernate.orm.test.envers.integration.secondary.SecondaryNamingTestEntity_AUD"
) )
.getJoinIterator()) .getJoins().get( 0 ).getTable().getName()
.next().getTable().getName()
); );
} }
} }

View File

@ -7,14 +7,13 @@
package org.hibernate.orm.test.envers.integration.secondary.ids; package org.hibernate.orm.test.envers.integration.secondary.ids;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase; import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase;
import org.hibernate.orm.test.envers.Priority; import org.hibernate.orm.test.envers.Priority;
import org.hibernate.orm.test.envers.entities.ids.EmbId; import org.hibernate.orm.test.envers.entities.ids.EmbId;
import org.hibernate.mapping.Join;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
@ -70,11 +69,10 @@ public class EmbIdSecondary extends BaseEnversJPAFunctionalTestCase {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void testTableNames() { public void testTableNames() {
assert "sec_embid_versions".equals( Assert.assertEquals( "sec_embid_versions",
((Iterator<Join>)
metadata().getEntityBinding( metadata().getEntityBinding(
"org.hibernate.orm.test.envers.integration.secondary.ids.SecondaryEmbIdTestEntity_AUD" "org.hibernate.orm.test.envers.integration.secondary.ids.SecondaryEmbIdTestEntity_AUD"
).getJoinIterator()).next().getTable().getName() ).getJoins().get( 0 ).getTable().getName()
); );
} }
} }

View File

@ -7,14 +7,14 @@
package org.hibernate.orm.test.envers.integration.secondary.ids; package org.hibernate.orm.test.envers.integration.secondary.ids;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator;
import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManager;
import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase; import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase;
import org.hibernate.orm.test.envers.Priority; import org.hibernate.orm.test.envers.Priority;
import org.hibernate.orm.test.envers.entities.ids.MulId; import org.hibernate.orm.test.envers.entities.ids.MulId;
import org.hibernate.mapping.Join;
import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
/** /**
@ -70,13 +70,11 @@ public class MulIdSecondary extends BaseEnversJPAFunctionalTestCase {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Test @Test
public void testTableNames() { public void testTableNames() {
assert "sec_mulid_versions".equals( Assert.assertEquals(
((Iterator<Join>) "sec_mulid_versions",
metadata().getEntityBinding( metadata().getEntityBinding(
"org.hibernate.orm.test.envers.integration.secondary.ids.SecondaryMulIdTestEntity_AUD" "org.hibernate.orm.test.envers.integration.secondary.ids.SecondaryMulIdTestEntity_AUD"
) ).getJoins().get( 0 ).getTable().getName()
.getJoinIterator())
.next().getTable().getName()
); );
} }
} }