Replaced a HQL query with JPA CriteriaQuery