HHH-17629 Reuse compatible joins for entity graphs and fetch profiles
This commit is contained in:
parent
e417dbe0ca
commit
11015687c8
|
@ -8169,21 +8169,33 @@ public abstract class BaseSqmToSqlAstConverter<T extends Statement> extends Base
|
||||||
fetchablePath,
|
fetchablePath,
|
||||||
np -> {
|
np -> {
|
||||||
// generate the join
|
// generate the join
|
||||||
|
final TableGroup tableGroup;
|
||||||
final TableGroup lhs = fromClauseIndex.getTableGroup( fetchParent.getNavigablePath() );
|
final TableGroup lhs = fromClauseIndex.getTableGroup( fetchParent.getNavigablePath() );
|
||||||
final TableGroupJoin tableGroupJoin = ( (TableGroupJoinProducer) fetchable ).createTableGroupJoin(
|
final TableGroupJoinProducer joinProducer = (TableGroupJoinProducer) fetchable;
|
||||||
fetchablePath,
|
final TableGroup compatibleTableGroup = lhs.findCompatibleJoinedGroup(
|
||||||
lhs,
|
joinProducer,
|
||||||
alias,
|
joinProducer.determineSqlJoinType( lhs, null, true )
|
||||||
null,
|
|
||||||
null,
|
|
||||||
true,
|
|
||||||
false,
|
|
||||||
BaseSqmToSqlAstConverter.this
|
|
||||||
);
|
);
|
||||||
lhs.addTableGroupJoin( tableGroupJoin );
|
if ( compatibleTableGroup == null ) {
|
||||||
|
final TableGroupJoin tableGroupJoin = joinProducer.createTableGroupJoin(
|
||||||
|
fetchablePath,
|
||||||
|
lhs,
|
||||||
|
alias,
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
false,
|
||||||
|
BaseSqmToSqlAstConverter.this
|
||||||
|
);
|
||||||
|
lhs.addTableGroupJoin( tableGroupJoin );
|
||||||
|
tableGroup = tableGroupJoin.getJoinedGroup();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tableGroup = compatibleTableGroup;
|
||||||
|
}
|
||||||
|
|
||||||
// and return the joined group
|
// and return the joined group
|
||||||
return tableGroupJoin.getJoinedGroup();
|
return tableGroup;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue