FileDocCategorySizeDatePackage
CustomerDAOBean.javaAPI DocJBoss 4.2.13016Fri Jul 13 20:54:40 BST 2007org.jboss.tutorial.callback.bean

CustomerDAOBean

public class CustomerDAOBean extends Object implements CustomerDAO

Fields Summary
private EntityManager
manager
Constructors Summary
Methods Summary
public intcreate(java.lang.String first, java.lang.String last, java.lang.String street, java.lang.String city, java.lang.String state, java.lang.String zip)

      System.out.println("-- CustomerDAOBean.create()");
      Customer customer = new Customer(first, last, street, city, state, zip);
      manager.persist(customer);
      return customer.getId();
   
public voiddelete(java.util.List l)

      System.out.println("-- CustomerDAOBean.delete()");
      for (Iterator it = l.iterator() ; it.hasNext() ; )
      {
         Customer c = (Customer)it.next();
         manager.remove(c);
      }
   
public Customerfind(int id)

      System.out.println("-- CustomerDAOBean.find()");
      return manager.find(Customer.class, id);
   
public java.util.ListfindByLastName(java.lang.String last)

      System.out.println("-- CustomerDAOBean.findByLastName(id)");
      return manager.createQuery("from Customer c where c.last = :last").setParameter("last", last).getResultList();
   
public voidmerge(Customer c)

      System.out.println("-- CustomerDAOBean.merge()");
      manager.merge(c);
   
public voidpostConstructCallback()

      System.out.println("PostConstruct - Have EntityManager: " + (manager != null));
   
public voidpreDestroyCallback()

      System.out.println("PreDestory - Have EntityManager: " + (manager != null));