Skip to content

Commit

Permalink
Added query fetches search for join existence when applying JPA order…
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonMolganov committed Apr 14, 2022
1 parent 7cbfad9 commit 1d1be82
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
* @author Greg Turnquist
* @author Diego Krupitza
* @author Jędrzej Biedrzycki
* @author Anton Molganov
*/
public abstract class QueryUtils {

Expand Down Expand Up @@ -806,6 +807,16 @@ private static <T> T getAnnotationProperty(Attribute<?, ?> attribute, String pro
return join;
}
}

for (Fetch<?, ?> fetch : from.getFetches()) {

Join<?, ?> join = (Join<?, ?>) fetch;
if (joinType == join.getJoinType()
&& join.getAttribute().getName().equals(attribute)) {
return join;
}
}

return from.join(attribute, joinType);
}

Expand Down

0 comments on commit 1d1be82

Please sign in to comment.