1 22 package org.jboss.ejb3.test.factoryxml; 23 24 import javax.ejb.Remove ; 25 import javax.ejb.TransactionAttribute ; 26 import javax.ejb.TransactionAttributeType ; 27 import javax.persistence.EntityManager; 28 import javax.persistence.PersistenceContext; 29 30 36 public class Stateful1Bean implements Stateful1 37 { 38 EntityManager manager1; 39 @PersistenceContext(name="manager2") EntityManager manager2; 40 41 Entity1 one; 42 Entity2 two; 43 44 public int create1() 45 { 46 one = new Entity1(); 47 one.setString("oneManager"); 48 manager1.persist(one); 49 return one.getId(); 50 } 51 52 public int create2() 53 { 54 two = new Entity2(); 55 two.setString("twoManager"); 56 manager2.persist(two); 57 return two.getId(); 58 } 59 60 public void update1() 61 { 62 one.setString("changed"); 63 } 64 65 public void update2() 66 { 67 two.setString("changed"); 68 } 69 70 @TransactionAttribute (TransactionAttributeType.NOT_SUPPORTED) 71 public void never() 72 { 73 one.setString("never"); 74 two.setString("never"); 75 } 76 77 @Remove 78 public void checkout() {} 79 80 81 } 82 | Popular Tags |