diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractCompositeIdentifierMapping.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractCompositeIdentifierMapping.java index 9b3b8fe102..c505a23fc7 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractCompositeIdentifierMapping.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/AbstractCompositeIdentifierMapping.java @@ -125,13 +125,7 @@ public abstract class AbstractCompositeIdentifierMapping boolean fetched, boolean addsPredicate, SqlAstCreationState creationState) { - final SqlAstJoinType joinType; - if ( requestedJoinType == null ) { - joinType = SqlAstJoinType.INNER; - } - else { - joinType = requestedJoinType; - } + final SqlAstJoinType joinType = determineSqlJoinType( lhs, requestedJoinType, fetched ); final TableGroup tableGroup = createRootTableGroupJoin( navigablePath, lhs, @@ -294,4 +288,5 @@ public abstract class AbstractCompositeIdentifierMapping public boolean containsTableReference(String tableExpression) { return entityMapping.containsTableReference( tableExpression ); } + } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java index 89bf582dba..2d15434cfa 100644 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/mapping/internal/PluralAttributeMappingImpl.java @@ -680,22 +680,6 @@ public class PluralAttributeMappingImpl ); } - private SqlAstJoinType determineSqlJoinType(TableGroup lhs, SqlAstJoinType requestedJoinType, boolean fetched) { - final SqlAstJoinType joinType; - if ( requestedJoinType == null ) { - if ( fetched ) { - joinType = getDefaultSqlAstJoinType( lhs ); - } - else { - joinType = SqlAstJoinType.INNER; - } - } - else { - joinType = requestedJoinType; - } - return joinType; - } - @Override public TableGroup createRootTableGroupJoin( NavigablePath navigablePath, @@ -707,9 +691,7 @@ public class PluralAttributeMappingImpl Consumer predicateConsumer, SqlAstCreationState creationState) { final CollectionPersister collectionDescriptor = getCollectionDescriptor(); - final SqlAstJoinType joinType = requestedJoinType == null - ? SqlAstJoinType.INNER - : requestedJoinType; + final SqlAstJoinType joinType = determineSqlJoinType( lhs, requestedJoinType, fetched ); final SqlAliasBase sqlAliasBase = creationState.getSqlAliasBaseGenerator().createSqlAliasBase( getSqlAliasStem() ); final TableGroup tableGroup; @@ -741,6 +723,7 @@ public class PluralAttributeMappingImpl return tableGroup; } + @Override public void setForeignKeyDescriptor(ForeignKeyDescriptor fkDescriptor) { this.fkDescriptor = fkDescriptor; 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 1cc94e09e8..5e1d7eaa6f 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 @@ -8,7 +8,6 @@ package org.hibernate.metamodel.mapping.internal; import java.util.Arrays; import java.util.HashSet; -import java.util.Iterator; import java.util.List; import java.util.Set; import java.util.function.BiConsumer; @@ -1984,22 +1983,6 @@ public class ToOneAttributeMapping return join; } - private SqlAstJoinType determineSqlJoinType(TableGroup lhs, SqlAstJoinType requestedJoinType, boolean fetched) { - final SqlAstJoinType joinType; - if ( requestedJoinType == null ) { - if ( fetched ) { - joinType = getDefaultSqlAstJoinType( lhs ); - } - else { - joinType = SqlAstJoinType.INNER; - } - } - else { - joinType = requestedJoinType; - } - return joinType; - } - @Override public LazyTableGroup createRootTableGroupJoin( NavigablePath navigablePath, diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/TableGroupJoinProducer.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/TableGroupJoinProducer.java index e19245d43f..52cb68bc3e 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/TableGroupJoinProducer.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/tree/from/TableGroupJoinProducer.java @@ -76,4 +76,20 @@ public interface TableGroupJoinProducer extends TableGroupProducer { boolean fetched, Consumer predicateConsumer, SqlAstCreationState creationState); + + default SqlAstJoinType determineSqlJoinType(TableGroup lhs, SqlAstJoinType requestedJoinType, boolean fetched) { + final SqlAstJoinType joinType; + if ( requestedJoinType == null ) { + if ( fetched ) { + joinType = getDefaultSqlAstJoinType( lhs ); + } + else { + joinType = SqlAstJoinType.INNER; + } + } + else { + joinType = requestedJoinType; + } + return joinType; + } }