users@glassfish.java.net

Inner transection in EJB3 using annotation (in stateless session bean)

From: <glassfish_at_javadesktop.org>
Date: Tue, 08 May 2007 11:09:23 PDT

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;
RequestOMKey createAndStartRequestOMByValue(RequestOMValue requestOMValue){

  updateOrder(requestOMValue);
  isSuccess=objMDNProductOrder.processOrder(this.em);
  if(isSuccess==true){
                    objMDNProductOrder.updateSuccessOrder(objMDNProductOrder);
  } else{
         objMDNProductOrder.updateFailOrder(objMDNProductOrder,"Erorr in processing order");
  }

 }
}

Now I want to achieve behavior that ,if any exception occurs in processOrder method then only tasks performed in processOrder should be rollback.
[Message sent by forum member 'niityasir' (niityasir)]

http://forums.java.net/jive/thread.jspa?messageID=216040