dcsimg
managing Container Managed Transaction
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   pawan_shrivastava
Posted On:   Monday, September 23, 2002 12:56 AM

Hi, I am maintaining Transaction in one session and two CMP entity beans. And i have noticed that Container only manages transaction when there is a oracle error.. i.e. ORA.... So, if i simulate the rollback condition by passing a null vector, it doesn't manage transaction. The code is something like this. In a session bean method i am looking up two entity beans.. { // inserting record in one table TableA //for loop with a vector //insert record in anpther table TableB } Transaction Attribute is Required for stateless, Mandatory for both entity beans.    More>>

Hi,



I am maintaining Transaction in one session and two CMP entity beans.


And i have noticed that Container only manages transaction when there is a oracle error.. i.e. ORA.... So, if i simulate the rollback condition by passing a null vector, it doesn't manage transaction.



The code is something like this.

In a session bean method i am looking up two entity beans..


{


// inserting record in one table TableA


//for loop with a vector

//insert record in anpther table TableB


}





Transaction Attribute is Required for stateless, Mandatory for both entity beans.



Now if i make this vector null...it throws NullPointerException and doesn't maintain a transaction that means data gets inserted in TableA.


But if there is a oralce error it maintains transaction well.



What is the workaroud of this situation with Container Managed Transaction. otherwise i have an option to do it with Programmatic Transaction.



Thank you very much

Pawan

   <<Less

Re: managing Container Managed Transaction

Posted By:   prashant_jani  
Posted On:   Sunday, September 29, 2002 10:45 PM



In your SB method make sure u call the rollback ..

try{
code to refer EJBs
}
catch(Ex )
{
sessionContext.setRollbackOnly() ;
}
About | Sitemap | Contact