-1
Hello, I am maintaining a code that should make a pagination using criteria put in the parameters of the method informs that pageable has never been used and I do not know how to implement it.
public List<Order> findOrderByFilter(OrderQueryDTO filter, int page, int size, Pageable pageable) {
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.ENGLISH);
CriteriaBuilder criteriaBuilder = em.getCriteriaBuilder();
CriteriaQuery<Order> criteriaQuery = criteriaBuilder.createQuery(Order.class);
Root<Order> root = criteriaQuery.from(Order.class);
List<Predicate> p = new ArrayList<>();
The rest below are several predicates to make multiple filters with if and elses at the end the return is like:
TypedQuery<Order> query = em.createQuery(criteriaQuery);
return query.getResultList();
Can you help me implement that pageable in that way?