public List<Element> findAllElements(Task task) {
logger.info("Try to find elements - task: {}", task.getId());
return em.createNamedQuery(Element.FIND_ALL_BY_TASK, Element.class)
.setParameter("task", task)
.getResultList();
}
getResultList method doesn't throw NoResultException, instead it returns empty list.
OdpowiedzUsuńYes, You are right - getSingleResult throws NoResultException. I changed this example. Thank You!
OdpowiedzUsuń