[go: up one dir, main page]

Skip to content

Commit

Permalink
Fixes an exception in the webapp when querying branches without any p…
Browse files Browse the repository at this point in the history
…aramerters
  • Loading branch information
mensinda authored and aurambaj committed Feb 22, 2024
1 parent 14c92a1 commit 9427ba2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
Expand All @@ -31,7 +32,10 @@ public Page<Long> findAllWithIdOnly(
CriteriaQuery<Long> idQuery = criteriaBuilder.createQuery(Long.class);
Root<BranchStatistic> root = idQuery.from(BranchStatistic.class);
if (specification != null) {
idQuery.where(specification.toPredicate(root, idQuery, criteriaBuilder));
Predicate predicate = specification.toPredicate(root, idQuery, criteriaBuilder);
if (predicate != null) {
idQuery.where(predicate);
}
}

Long count = getTotalCount(specification, criteriaBuilder, idQuery, root);
Expand Down

0 comments on commit 9427ba2

Please sign in to comment.