Java Tutorial/EJB3/Remote Local Interface — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Текущая версия на 08:02, 1 июня 2010
EJB With Remote Interface
File: EmployeeBean.java
<source lang="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()); }
}</source>