1 Reply Latest reply on May 8, 2007 6:29 PM by Carlo de Wolf

    Inner transection in EJB3 using annotation (in stateless ses

    Yasir Siddiqi Newbie

      HI

      I am facing problem in implementing inner transaction. I am using JBoss, NetBeans IDE and EJB3.0 . For transaction management I want to use annotations(like TransactionAttributeType.REQUIRES_NEW or any other). I want to implement some sort of inner transation. In my method of session bean I am performing following task in sequence.

      @Stateless
      public class JVTOSSOMSessionBean implements JVTOSSOMSessionRemote, JVTOSSOMSessionLocal, JVTOrderManagementSession {
      
       @PersistenceContext
       private EntityManager em;
       RequestOMValue objRequestOMValue;
       /** Creates a new instance of JVTOSSOMSessionBean */
       public JVTOSSOMSessionBean() {
       }
      
       public RequestOMKey createAndStartRequestOMByValue(RequestOMValue requestOMValue) throws OssIllegalArgumentException, RemoteException, ObjectNotFoundException {
       boolean isSuccess=true;
       RequestOMKey mdnOrderKey=requestOMValue.updateOrder();
       isSuccess=requestOMValue.processOrder(this.em);
       if(isSuccess==true){
       requestOMValue.updateSuccessOrder();
       } else{
       requestOMValue.updateFailOrder();
       }
       return mdnOrderKey;
       }
      




      Now I want to achieve behavior that ,if any exception occurs in processOrder method then only tasks performed in processOrder are rollback.

      Curretly if any exception occur then all tasks roll back , which also include tasks that i perform in updateSuccessOrder , updateFailOrder , updateOrder and processOrder.