Java Tutorial/EJB3/Remote Local Interface
Версия от 17:44, 31 мая 2010; (обсуждение)
EJB With Remote Interface
File: EmployeeBean.java
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless
public class EmployeeBean implements EmployeeServiceLocal, EmployeeServiceRemote {
@PersistenceContext(unitName="EmployeeService") private EntityManager manager;
public void doAction(){
Customer cust = new Customer();
cust.setFirstName("Joe");
manager.persist(cust);
System.out.println("Saved");
cust = manager.find(Customer.class,cust.getId());
System.out.println(cust.getFirstName());
}
}