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