KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > tutorial > deploydir > CustomerDAOBean


1 /*
2  * JBoss, the OpenSource J2EE webOS
3  *
4  * Distributable under LGPL license.
5  * See terms of license at gnu.org.
6  */

7 package org.jboss.tutorial.deploydir;
8
9 import javax.ejb.Stateless JavaDoc;
10 import javax.persistence.PersistenceContext;
11 import javax.persistence.EntityManager;
12
13 /**
14  * Comment
15  *
16  * @author <a HREF="mailto:bill@jboss.org">Bill Burke</a>
17  * @version $Revision: 1.1 $
18  */

19 @Stateless JavaDoc
20 public class CustomerDAOBean implements CustomerDAOLocal, CustomerDAORemote
21 {
22    @PersistenceContext(unitName="custdb") private EntityManager em;
23
24    public int createCustomer(String JavaDoc name)
25    {
26       Customer cust = new Customer();
27       cust.setName(name);
28       em.persist(cust);
29       return cust.getId();
30    }
31
32    public Customer findCustomer(int id)
33    {
34       return em.find(Customer.class, id);
35    }
36 }
37
Popular Tags