@Test public void testGetDrugInfoByName() { String name = "TestDrugInfo1"; String result = dao.getDrugInfoByName(name).get(0).getName(); assertEquals(name, result); }
@Override public List<DrugInfo> getDrugInfoByName(String name) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); criteria.add(Restrictions.like("name", name)); criteria.add(Restrictions.like("retired", false)); List<DrugInfo> patients = new ArrayList<DrugInfo>(); patients.addAll(criteria.list()); return patients; }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getDrugInfoByName(String name) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); criteria.add(Restrictions.like("name", name)); criteria.add(Restrictions.like("retired", false)); List<DrugInfo> patients = new ArrayList<DrugInfo>(); patients.addAll(criteria.list()); return patients; } }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getDrugInfoByName(String name) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); criteria.add(Restrictions.like("name", name)); criteria.add(Restrictions.like("retired", false)); List<DrugInfo> patients = new ArrayList<DrugInfo>(); patients.addAll(criteria.list()); return patients; }  }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getDrugInfoByName(String name) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); criteria.add(Restrictions.like("name", name)); criteria.add(Restrictions.like("retired", false)); List<DrugInfo> patients = new ArrayList<DrugInfo>(); patients.addAll(criteria.list()); return patients; }  void setSessionFactory(SessionFactory sessionFactory); @Override DrugInfo saveDrugInfo(DrugInfo drugInfo); @Override void deleteDrugInfo(DrugInfo drugInfo); @Override DrugInfo getDrugInfo(Integer drugInfoId); @Override DrugInfo getDrugInfoByUuid(String uuid); @Override List<DrugInfo> getDrugInfoByName(String name); @Override DrugInfo getDrugInfoByDrug(Integer id); @Override List<DrugInfo> getAllDrugInfo(boolean includeRetired); @Override DrugInfo updateDrugInfo(DrugInfo drugInfo); }
HibernateDrugInfoDAO implements DrugInfoDAO { @Override public List<DrugInfo> getDrugInfoByName(String name) throws DAOException { Criteria criteria = sessionFactory.getCurrentSession().createCriteria(DrugInfo.class); criteria.add(Restrictions.like("name", name)); criteria.add(Restrictions.like("retired", false)); List<DrugInfo> patients = new ArrayList<DrugInfo>(); patients.addAll(criteria.list()); return patients; }  void setSessionFactory(SessionFactory sessionFactory); @Override DrugInfo saveDrugInfo(DrugInfo drugInfo); @Override void deleteDrugInfo(DrugInfo drugInfo); @Override DrugInfo getDrugInfo(Integer drugInfoId); @Override DrugInfo getDrugInfoByUuid(String uuid); @Override List<DrugInfo> getDrugInfoByName(String name); @Override DrugInfo getDrugInfoByDrug(Integer id); @Override List<DrugInfo> getAllDrugInfo(boolean includeRetired); @Override DrugInfo updateDrugInfo(DrugInfo drugInfo);  }