// this should happen at DAO creation
// begin Hibernate transaction
//HibernateUtil.beginTransaction();
// create DAO instance
CustomerDAO dao = new CustomerDAO();
if (dao == null){
throw new AuthenticationException ("Error initializing dao");
}
// create example object for query
Customer loginCustomer = new Customer();
loginCustomer.setUsername(username);
// find member object by example
Collection matchingCustomers = dao.findByExample(loginCustomer);
Iterator memberIter = matchingCustomers.iterator();
if (memberIter.hasNext()) {
loginCustomer = (Customer) memberIter.next();
} else loginCustomer = null;