[jboss-user] [EJB 3.0] - Inner transection in EJB3 using annotation (in stateless ses

niityasir@hotmail.com do-not-reply at jboss.com
Tue May 8 14:24:00 EDT 2007


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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044016#4044016

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044016



More information about the jboss-user mailing list