diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEntityCollectionPart.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEntityCollectionPart.java index 5aebdd6d34..a7d354025f 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEntityCollectionPart.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/AbstractEntityCollectionPart.java @@ -334,7 +334,7 @@ public abstract class AbstractEntityCollectionPart implements EntityCollectionPa primaryTableReference, true, sqlAliasBase, - (tableExpression) -> getEntityMappingType().containsTableReference( tableExpression ), + getEntityMappingType().getRootEntityDescriptor()::containsTableReference, (tableExpression, tg) -> getEntityMappingType().createTableReferenceJoin( tableExpression, sqlAliasBase, 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 3de7655467..b54f57314b 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 @@ -2318,7 +2318,7 @@ public class ToOneAttributeMapping primaryTableReference, true, sqlAliasBase, - (tableExpression) -> getEntityMappingType().containsTableReference( tableExpression ), + getEntityMappingType().getRootEntityDescriptor()::containsTableReference, (tableExpression, tg) -> getEntityMappingType().createTableReferenceJoin( tableExpression, sqlAliasBase, 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 eefefb7b8b..b893ee6d92 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 @@ -3024,7 +3024,7 @@ public abstract class AbstractEntityPersister rootTableReference, true, sqlAliasBase, - (tableExpression) -> getRootEntityDescriptor().containsTableReference( tableExpression ), + getRootEntityDescriptor()::containsTableReference, (tableExpression, tg) -> { final String[] subclassTableNames = getSubclassTableNames(); for ( int i = 0; i < subclassTableNames.length; i++ ) { diff --git a/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleEntityValuedModelPart.java b/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleEntityValuedModelPart.java index 797033d5fe..3e42ac65dc 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleEntityValuedModelPart.java +++ b/hibernate-core/src/main/java/org/hibernate/query/derived/AnonymousTupleEntityValuedModelPart.java @@ -430,7 +430,7 @@ public class AnonymousTupleEntityValuedModelPart primaryTableReference, true, sqlAliasBase, - entityMappingType::containsTableReference, + entityMappingType.getRootEntityDescriptor()::containsTableReference, (tableExpression, tg) -> entityMappingType.createTableReferenceJoin( tableExpression, sqlAliasBase,