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() ) {
79727972 fetchablePath ,
79737973 np -> {
79747974 // generate the join
7975+ final TableGroup tableGroup ;
79757976 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 )
79857981 );
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+ }
79877999
79888000 // and return the joined group
7989- return tableGroupJoin . getJoinedGroup () ;
8001+ return tableGroup ;
79908002 }
79918003 );
79928004 }
You can’t perform that action at this time.
0 commit comments