HHH-16885 Hibernate 6.x changes outer to inner join when @EntityGraph and @Id
This commit is contained in:
parent
aa0af5a30d
commit
e85d2040c2
|
@ -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 );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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<Predicate> 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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -76,4 +76,20 @@ public interface TableGroupJoinProducer extends TableGroupProducer {
|
|||
boolean fetched,
|
||||
Consumer<Predicate> 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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue