2

I'm trying to get the count of total results from table in spring Data JPA but some how I am getting this error Query argument pattern not found in the list of parameters provided during query execution.

below is what I tried:

CriteriaQuery<Long> countQuery = criteriaBuilder
  .createQuery(Long.class);
countQuery.select(criteriaBuilder
  .count(countQuery.from(Foo.class))).where(criteriaBuilder.and(predicates.toArray(new Predicate[predicates.size()])));

Long count = entityManager.createQuery(countQuery)
  .getSingleResult();

I found examples on google but with out predicates. when I include predicate I got the above exception.

Developer
  • 2,389
  • 4
  • 11
  • 17

0 Answers0