Skip to content

Commit

Permalink
[fix] Remove JOIN FETCH when using COUNT query (#68)
Browse files Browse the repository at this point in the history
Previous versions of Spring still need this check.
  • Loading branch information
darrachequesne authored Dec 24, 2017
1 parent da86c5d commit b99ed24
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ private class DataTablesSpecification<S> implements Specification<S> {
public Predicate toPredicate(Root<S> root, CriteriaQuery<?> query, CriteriaBuilder criteriaBuilder) {
initPredicatesRecursively(tree, root, root, criteriaBuilder);

boolean isCountQuery = query.getResultType() == Long.class;
if (isCountQuery) {
root.getFetches().clear();
}

return createFinalPredicate(criteriaBuilder);
}

Expand Down

0 comments on commit b99ed24

Please sign in to comment.