1 22 package org.jboss.ejb3.test.regression.ejbthree316; 23 24 import java.io.Serializable ; 25 import javax.ejb.Stateful ; 26 import javax.persistence.EntityManager; 27 import javax.persistence.PersistenceContext; 28 import org.jboss.annotation.ejb.RemoteBinding; 29 import org.jboss.annotation.ejb.cache.simple.CacheConfig; 30 31 37 @Stateful 38 @CacheConfig(idleTimeoutSeconds = 2) 39 @RemoteBinding(jndiBinding = "NonExtended") 40 public class NonExtendedStatefuBean implements Serializable , StatefulRemote 41 { 42 @PersistenceContext 43 EntityManager manager; 44 45 public int doit() 46 { 47 Customer cust = new Customer(); 48 cust.setName("Bill"); 49 manager.persist(cust); 50 return cust.getId(); 51 } 52 53 public void find(int id) 54 { 55 if (manager.find(Customer.class, id) == null) throw new RuntimeException ("not found"); 56 } 57 } 58 | Popular Tags |