I've used hibernate for a long time. Recently I started using JPA, but I can't find a short way to write a simple select in less than these seven lines (the use of criteria is a must in this project).Is there a shorter way to build this query?public List<Transaction> findDevolucionesByOriginalOperationId(String originalOperationId) {    CriteriaBuilder cb = em.getCriteriaBuilder();    CriteriaQuery<Transaction> cq = cb.createQuery(Transaction.class);    Root<Transaction> root = cq.from(Transaction.class);    Collection<Predicate>  predicates = new ArrayList<Predicate>();    predicates.add(cb.equal(root.get(originalOperationId), originalOperationId));    cq.where(predicates.toArray(new Predicate[predicates.size()]));    List<Transaction> resultado = em.createQuery(cq).getResultList();    return resultado;}
Shortening JPA criteria query boilerplate
java;hibernate;jpa