Package com.ateam.webstore.dao

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

/**
*
*/
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.Cart;

/**
* @author Hendrix Tavarez
*
*/
public class CartDAO extends GenericDAOImpl<Cart, Serializable> {

  public Cart getByCustomer(Serializable customer) {
   
    Cart cart = null;
   
    try {
      Query query = getPersistenceManager().newQuery(getPersistentClass(), "customer == :customer");
      query.setUnique(true);
      cart = (Cart) query.execute(customer);
     
      return getPersistenceManager().detachCopy(cart);
     
    } catch (RuntimeException re) {
      throw re;
    } finally {
      getPersistenceManager().close();
    }
  }
}
TOP

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

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.