Hello, I'm trying to check the size of the return list in one of my method in DAO. But it always return 0; When executing "mvn test -Dtest=NameDaoTest" does it create and populate new data in my database? I noticed that all my data in database is gone. I guest it automatically call the "mvn hibernate3:hbm2ddl dbunit:operation".. how can i bypass it so that i can retrieve data in my database. I am expecting the size of the list to be 142882 and i want to put assert in my test. Here is my code

DaoTest:

public void testGetProduct() {
       for(int i = 1; i <= 5; i++) {
List countries = groupProductDao.findByServiceIdAndSubList("6561", "U");
           assertEquals(countries.size(),142882);
}
   }

DaoHibernate:

public List<GroupProduct> findByServiceIdAndSubList(String serviceId, String subList) {
       Long serviceIdLong = Long.valueOf(serviceId);
       List<GroupProduct> gpDTOList = new ArrayList<GroupProduct>();

       if (subList.equals("")) {
List<String> descList = new ArrayList<String>(); descList = getHibernateTemplate().find("select description from GroupProduct where version=0 and serviceID=? order by description asc", serviceIdLong);
           if (descList.size() != 0) {
               subList = descList.get(0).substring(0,1);
           }
       }
gpDTOList = getHibernateTemplate().find("from GroupProduct where version=0 and serviceID=? and description like '"+subList+"%' order by description asc", serviceIdLong);

        return gpDTOList;
   }



Please help..






---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
For additional commands, e-mail: users-h...@appfuse.dev.java.net

Reply via email to