Package com.ateam.webstore.dao

Source Code of com.ateam.webstore.dao.CustomerDAO

package com.ateam.webstore.dao;

import java.io.Serializable;

import javax.jdo.Query;

import com.ateam.webstore.dao.common.GenericDAOImpl;
import com.ateam.webstore.model.Customer;

public class CustomerDAO extends GenericDAOImpl<Customer, Serializable> {
 
  public Customer getCustomerByPersonID(Serializable id) {
   
    Customer customer = null;
   
    try {
      Query query = getPersistenceManager().newQuery(getPersistentClass(), "personID == :id");
      query.setUnique(true);
      customer = (Customer) query.execute(id);
     
      return getPersistenceManager().detachCopy(customer);
     
    } catch (RuntimeException re) {
      throw re;
    } finally {
      getPersistenceManager().close();
    }
  }

}
TOP

Related Classes of com.ateam.webstore.dao.CustomerDAO

TOP
Copyright © 2018 www.massapi.com. 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.