HHH-16885 Hibernate 6.x changes outer to inner join when @EntityGraph and @Id
This commit is contained in:
parent
f808546570
commit
383653d5d4
|
@ -126,13 +126,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,
|
||||
|
@ -295,4 +289,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;
|
||||
|
|
|
@ -1991,22 +1991,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