Jpa Criteria API count
问题 I've been trying to get total rows count and to do so, I've used JPA Criteria API but it throws an error at Long count = em.createQuery(sc).getSingleResult(); line and saying java.lang.IllegalStateException: No criteria query roots were specified . I've done some research but couldn't narrow the problem. Here's my code snippet; @PersistenceContext public EntityManager em; ...... public Page<UserDTO> findByCriteria(String filters, Pageable pageable) { CriteriaBuilder cb = em.getCriteriaBuilder