1 25 26 package org.objectweb.easybeans.examples.entitybean; 27 28 import javax.ejb.Remote ; 29 import javax.ejb.Stateless ; 30 import javax.persistence.EntityManager; 31 import javax.persistence.PersistenceContext; 32 33 37 @Stateless 38 @Remote (SessionFacadeRemote.class) 39 public class SessionFacade implements SessionFacadeRemote { 40 41 44 @PersistenceContext 45 private EntityManager entityManager = null; 46 47 52 public void addEmployee(final int id, final String name) { 53 Employee employee = new Employee(); 54 employee.setId(id); 55 employee.setName(name); 56 entityManager.persist(employee); 57 } 58 59 64 public Employee findEmployee(final int id) { 65 return entityManager.find(Employee.class, Integer.valueOf(id)); 66 } 67 68 } 69 | Popular Tags |