@Test public void getByAccountId() { PatientData pd = persistTestEntity(); PatientAccount pa = TestPLCEntityFactory.createPatientAccount(); getTestDao().getEntityManager().getTransaction().begin(); getTestDao().getEntityManager().persist(pa); pd.setPatientAccount(pa); getTestDao().save(pd); getTestDao().getEntityManager().getTransaction().commit(); List<PatientData> results = getTestDao().getByAccountId(pa.getId()); assertFalse(results.isEmpty()); assertEquals(1, results.size()); }
@SuppressWarnings("unchecked") @Transactional public List<PatientData> getByAccountId(Long id) { StringBuilder builder = new StringBuilder(); builder.append("select pd from ").append(getEntityType().getName()) .append(" pd where pd.patientAccount.id = :id"); Query query = getEntityManager().createQuery(builder.toString()); query.setParameter("id", id); return query.getResultList(); }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @SuppressWarnings("unchecked") @Transactional public List<PatientData> getByAccountId(Long id) { StringBuilder builder = new StringBuilder(); builder.append("select pd from ").append(getEntityType().getName()) .append(" pd where pd.patientAccount.id = :id"); Query query = getEntityManager().createQuery(builder.toString()); query.setParameter("id", id); return query.getResultList(); } }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @SuppressWarnings("unchecked") @Transactional public List<PatientData> getByAccountId(Long id) { StringBuilder builder = new StringBuilder(); builder.append("select pd from ").append(getEntityType().getName()) .append(" pd where pd.patientAccount.id = :id"); Query query = getEntityManager().createQuery(builder.toString()); query.setParameter("id", id); return query.getResultList(); } @Inject  PatientDataJPADao(EntityManager em); }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @SuppressWarnings("unchecked") @Transactional public List<PatientData> getByAccountId(Long id) { StringBuilder builder = new StringBuilder(); builder.append("select pd from ").append(getEntityType().getName()) .append(" pd where pd.patientAccount.id = :id"); Query query = getEntityManager().createQuery(builder.toString()); query.setParameter("id", id); return query.getResultList(); } @Inject  PatientDataJPADao(EntityManager em); @SuppressWarnings("unchecked") @Transactional List<PatientData> getByAccountId(Long id); @Transactional @Override Summary getPatientDataSummary(Filter filter); @SuppressWarnings("unchecked") @Override List<FileInfo> getPatientData(Filter filter); @Override long normalizeFileSize(long size); }
PatientDataJPADao extends AbstractPLCEntityDao<PatientData> implements PatientDataDao { @SuppressWarnings("unchecked") @Transactional public List<PatientData> getByAccountId(Long id) { StringBuilder builder = new StringBuilder(); builder.append("select pd from ").append(getEntityType().getName()) .append(" pd where pd.patientAccount.id = :id"); Query query = getEntityManager().createQuery(builder.toString()); query.setParameter("id", id); return query.getResultList(); } @Inject  PatientDataJPADao(EntityManager em); @SuppressWarnings("unchecked") @Transactional List<PatientData> getByAccountId(Long id); @Transactional @Override Summary getPatientDataSummary(Filter filter); @SuppressWarnings("unchecked") @Override List<FileInfo> getPatientData(Filter filter); @Override long normalizeFileSize(long size);  }