Package org.simplecart.exceptions

Examples of org.simplecart.exceptions.AuthenticationException


        //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;

        if ((loginCustomer == null) || !password.equals(loginCustomer.getPassword())) {
            throw new AuthenticationException ("Error validating user");
        }

        // commit this transaction
        HibernateUtility.commitTransaction();
        HibernateUtility.closeSession();
View Full Code Here


        //HibernateUtil.beginTransaction();
       
        // create DAO instance
        AdministratorDAO dao = new AdministratorDAO();
        if (dao == null){
            throw new AuthenticationException ("Error initializing dao");
        }

        // create example object for query
        Administrator loginAdministrator = new Administrator();
        loginAdministrator.setUsername(username);
       
        // find member object by example
        Collection matchingAdministrators = dao.findByExample(loginAdministrator);
        Iterator memberIter = matchingAdministrators.iterator();
        if (memberIter.hasNext()) {
            loginAdministrator = (Administrator) memberIter.next();
        } else loginAdministrator = null;

        if ((loginAdministrator == null) || !password.equals(loginAdministrator.getPassword())) {
            throw new AuthenticationException ("Error validating user");
        }

        // commit this transaction
        HibernateUtility.commitTransaction();
        HibernateUtility.closeSession();
View Full Code Here

TOP

Related Classes of org.simplecart.exceptions.AuthenticationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.