1 package example; 2 3 import javax.ejb.Stateless ; 4 5 import javax.ejb.TransactionAttribute ; 6 import static javax.ejb.TransactionAttributeType.REQUIRED ; 7 import static javax.ejb.TransactionAttributeType.SUPPORTS ; 8 9 12 @Stateless (name="swap") 13 public class SwapBean implements Swap { 14 17 @TransactionAttribute (REQUIRED) 18 public void swap(Course a, Course b) 19 { 20 String teacher = a.getTeacher(); 21 a.setTeacher(b.getTeacher()); 22 b.setTeacher(teacher); 23 } 24 25 28 @TransactionAttribute (SUPPORTS) 29 public String getTeacher(Course a) 30 { 31 return a.getTeacher(); 32 } 33 } 34 | Popular Tags |