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 Feb 8, 2022
1 parent d0c3b1a commit d76bce7
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
* @author Andriy Redko
* @author Peter Großmann
* @author Greg Turnquist
* @author Anton Molganov
*/
public abstract class QueryUtils {

Expand Down Expand Up @@ -775,6 +776,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 d76bce7

Please sign in to comment.