File tree Expand file tree Collapse file tree 1 file changed +23
-11
lines changed
hibernate-core/src/main/java/org/hibernate/query/sqm/sql Expand file tree Collapse file tree 1 file changed +23
-11
lines changed Original file line number Diff line number Diff line change @@ -7972,21 +7972,33 @@ else if ( getLoadQueryInfluencers().hasEnabledFetchProfiles() ) {
7972
7972
fetchablePath ,
7973
7973
np -> {
7974
7974
// generate the join
7975
+ final TableGroup tableGroup ;
7975
7976
final TableGroup lhs = fromClauseIndex .getTableGroup ( fetchParent .getNavigablePath () );
7976
- final TableGroupJoin tableGroupJoin = ( (TableGroupJoinProducer ) fetchable ).createTableGroupJoin (
7977
- fetchablePath ,
7978
- lhs ,
7979
- alias ,
7980
- null ,
7981
- null ,
7982
- true ,
7983
- false ,
7984
- BaseSqmToSqlAstConverter .this
7977
+ final TableGroupJoinProducer joinProducer = (TableGroupJoinProducer ) fetchable ;
7978
+ final TableGroup compatibleTableGroup = lhs .findCompatibleJoinedGroup (
7979
+ joinProducer ,
7980
+ joinProducer .determineSqlJoinType ( lhs , null , true )
7985
7981
);
7986
- lhs .addTableGroupJoin ( tableGroupJoin );
7982
+ if ( compatibleTableGroup == null ) {
7983
+ final TableGroupJoin tableGroupJoin = joinProducer .createTableGroupJoin (
7984
+ fetchablePath ,
7985
+ lhs ,
7986
+ alias ,
7987
+ null ,
7988
+ null ,
7989
+ true ,
7990
+ false ,
7991
+ BaseSqmToSqlAstConverter .this
7992
+ );
7993
+ lhs .addTableGroupJoin ( tableGroupJoin );
7994
+ tableGroup = tableGroupJoin .getJoinedGroup ();
7995
+ }
7996
+ else {
7997
+ tableGroup = compatibleTableGroup ;
7998
+ }
7987
7999
7988
8000
// and return the joined group
7989
- return tableGroupJoin . getJoinedGroup () ;
8001
+ return tableGroup ;
7990
8002
}
7991
8003
);
7992
8004
}
You can’t perform that action at this time.
0 commit comments