package test.org.itscool.commons.dao4;

import java.util.List;

import org.itscool.commons.connection.Transaction;
import org.itscool.commons.connection.TransactionUtil;
import org.itscool.commons.dao.BaseDao;
import org.itscool.commons.dao.Criteria;
import org.itscool.weber.testcase.WeberDbTestCase;

public class BaseDaoTest extends WeberDbTestCase{
    public void setUp(){
        this.clearTables();
        this.initTables("test/org/itscool/commons/dao4/test-db-data.xml");
    }
    
    public void testSelect1(){
        BaseDao dao = new BaseDao();
        Criteria crt = new Criteria(Company2.class);
        
        List list = dao.select(crt);
        for( int i=0; i<list.size(); i++){
            Company2 company = (Company2)list.get(i);
            System.out.println("COMPANY:" + company.getName());
            List customers = company.getCustomers();
            for( int j =0; j<customers.size(); j++){
                Customer2 customer = (Customer2)customers.get(j);
                System.out.println(" CUSTOMER:" + customer.getName());
            }
        }
    }
}
