dcsimg
Container managed transaction for a stateless session bean.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   madhuri_chalke
Posted On:   Monday, June 7, 2004 04:37 AM

Following is the deployment descriptor for a stateless session bean (ejb-jar.xml): .......... Container ............. AccessSetup addUser Required I am using JRun 4.0. I have a method in a stateless session bean called addUser that inserts data into 3 different tables. The insert statements are in the same method. I want the container to manage the transaction for me for this method. The above statements in the deployment descriptor do not work! Even if there is an exception in the second insert ststement, it does not roll back the record from the first table. Is there anything miss   More>>

Following is the deployment descriptor for a stateless session bean (ejb-jar.xml):



..........

Container

.............









AccessSetup

addUser



Required








I am using JRun 4.0. I have a method in a stateless session bean called addUser that inserts data into 3 different tables. The insert statements are in the same method. I want the container to manage the transaction for me for this method. The above statements in the deployment descriptor do not work! Even if there is an exception in the second insert ststement, it does not roll back the record from the first table. Is there anything missing in the deployment descriptor? Do I need to explicitly write rollback() statement in my code?

   <<Less

Re: Container managed transaction for a stateless session bean.

Posted By:   Pardeep_Sharma  
Posted On:   Wednesday, June 9, 2004 06:51 AM

Yes, in your catch block where exception is caught, you need to call context.setRollbackOnly(); method to tell the container that your transaction should be rolled back.
Thanks
Pardeep Sharma
About | Sitemap | Contact