@Test public void testList() throws Exception { log.info("testList"); ArrayList<Person> persons = null; daoUtils.truncateTable("persons"); Person p = personDAO.createPerson(testPerson); Person p2 = personDAO.createPerson(testPerson2); persons = personDAO.listPersons(); log.info("persons count : " + persons.size()); Assert.assertTrue(persons.size() > 0); personDAO.deletePerson(p.getPersonID()); personDAO.deletePerson(p2.getPersonID()); }
private List<SamplePE> listSamplesByCriteria( final Criteria basicCriteria, boolean withExperimentAndProperties, Criterion... additionalCriterions) throws DataAccessException { for (Criterion criterion : additionalCriterions) { basicCriteria.add(criterion); } final int count = DAOUtils.getCount(basicCriteria); if (withExperimentAndProperties) { basicCriteria.setFetchMode("experimentInternal", FetchMode.JOIN); if (count <= DAOUtils.MAX_COUNT_FOR_PROPERTIES) { basicCriteria.setFetchMode("sampleProperties", FetchMode.JOIN); } else { operationLog.info(String.format("Found %d samples, disable properties loading.", count)); } } basicCriteria.setResultTransformer(Criteria.DISTINCT_ROOT_ENTITY); return cast(basicCriteria.list()); }