April 2018
Intermediate to advanced
202 pages
4h 48m
English
Let's start, then, by adding a parameter for the ordering configuration to the find method of the CallRepository in the example application:
public static List<Call> find(int offset, int limit, String filter, Map<String, Boolean> order) { return JPAService.runInTransaction(em -> { String jpql = "select c from Call c where lower(c.client) like :filter or c.phoneNumber like :filter or lower(c.city) like :filter" + buildOrderByClause(sort); Query query = em.createQuery(jpql); query.setParameter("filter", "%" + filter.trim().toLowerCase() + "%"); query.setFirstResult(offset); query.setMaxResults(limit); List<Call> resultList = query.getResultList(); return resultList; });}
The order parameter contains the name of ...
Read now
Unlock full access