@Test public void testFindAuditWithTest() { Audit audit = auditDAO.findAuditWithTest(1L); assertEquals(Long.valueOf(1), audit.getId()); assertEquals(10, audit.getTestList().size()); audit = auditDAO.findAuditWithTest(2L); assertEquals(Long.valueOf(2), audit.getId()); assertEquals(10, audit.getTestList().size()); }
@Override public Audit findAuditWithTest(Long id) { Query query = entityManager.createQuery("SELECT a FROM " + getEntityClass().getName() + " a" + " LEFT JOIN FETCH a.testList" + " WHERE a.id = :id"); query.setParameter("id", id); try { return (Audit)query.getSingleResult(); } catch (NoResultException nre) { return null; } }
AuditDAOImpl extends AbstractJPADAO<Audit, Long> implements AuditDAO { @Override public Audit findAuditWithTest(Long id) { Query query = entityManager.createQuery("SELECT a FROM " + getEntityClass().getName() + " a" + " LEFT JOIN FETCH a.testList" + " WHERE a.id = :id"); query.setParameter("id", id); try { return (Audit)query.getSingleResult(); } catch (NoResultException nre) { return null; } } }
AuditDAOImpl extends AbstractJPADAO<Audit, Long> implements AuditDAO { @Override public Audit findAuditWithTest(Long id) { Query query = entityManager.createQuery("SELECT a FROM " + getEntityClass().getName() + " a" + " LEFT JOIN FETCH a.testList" + " WHERE a.id = :id"); query.setParameter("id", id); try { return (Audit)query.getSingleResult(); } catch (NoResultException nre) { return null; } } AuditDAOImpl(); }
AuditDAOImpl extends AbstractJPADAO<Audit, Long> implements AuditDAO { @Override public Audit findAuditWithTest(Long id) { Query query = entityManager.createQuery("SELECT a FROM " + getEntityClass().getName() + " a" + " LEFT JOIN FETCH a.testList" + " WHERE a.id = :id"); query.setParameter("id", id); try { return (Audit)query.getSingleResult(); } catch (NoResultException nre) { return null; } } AuditDAOImpl(); @Override List<Audit> findAll(); @Override List<Audit> findAll(AuditStatus status); @Override Audit findAuditWithTest(Long id); @Override List<Audit> findAllByTag(String tag); }
AuditDAOImpl extends AbstractJPADAO<Audit, Long> implements AuditDAO { @Override public Audit findAuditWithTest(Long id) { Query query = entityManager.createQuery("SELECT a FROM " + getEntityClass().getName() + " a" + " LEFT JOIN FETCH a.testList" + " WHERE a.id = :id"); query.setParameter("id", id); try { return (Audit)query.getSingleResult(); } catch (NoResultException nre) { return null; } } AuditDAOImpl(); @Override List<Audit> findAll(); @Override List<Audit> findAll(AuditStatus status); @Override Audit findAuditWithTest(Long id); @Override List<Audit> findAllByTag(String tag);  }