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 @@ -8148,21 +8148,33 @@ else if ( getLoadQueryInfluencers().hasEnabledFetchProfiles() ) {
8148
8148
fetchablePath ,
8149
8149
np -> {
8150
8150
// generate the join
8151
+ final TableGroup tableGroup ;
8151
8152
final TableGroup lhs = fromClauseIndex .getTableGroup ( fetchParent .getNavigablePath () );
8152
- final TableGroupJoin tableGroupJoin = ( (TableGroupJoinProducer ) fetchable ).createTableGroupJoin (
8153
- fetchablePath ,
8154
- lhs ,
8155
- alias ,
8156
- null ,
8157
- null ,
8158
- true ,
8159
- false ,
8160
- BaseSqmToSqlAstConverter .this
8153
+ final TableGroupJoinProducer joinProducer = (TableGroupJoinProducer ) fetchable ;
8154
+ final TableGroup compatibleTableGroup = lhs .findCompatibleJoinedGroup (
8155
+ joinProducer ,
8156
+ joinProducer .determineSqlJoinType ( lhs , null , true )
8161
8157
);
8162
- lhs .addTableGroupJoin ( tableGroupJoin );
8158
+ if ( compatibleTableGroup == null ) {
8159
+ final TableGroupJoin tableGroupJoin = joinProducer .createTableGroupJoin (
8160
+ fetchablePath ,
8161
+ lhs ,
8162
+ alias ,
8163
+ null ,
8164
+ null ,
8165
+ true ,
8166
+ false ,
8167
+ BaseSqmToSqlAstConverter .this
8168
+ );
8169
+ lhs .addTableGroupJoin ( tableGroupJoin );
8170
+ tableGroup = tableGroupJoin .getJoinedGroup ();
8171
+ }
8172
+ else {
8173
+ tableGroup = compatibleTableGroup ;
8174
+ }
8163
8175
8164
8176
// and return the joined group
8165
- return tableGroupJoin . getJoinedGroup () ;
8177
+ return tableGroup ;
8166
8178
}
8167
8179
);
8168
8180
}
You can’t perform that action at this time.
0 commit comments