File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes setRollbackOnly not working Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "setRollbackOnly not working" Watch "setRollbackOnly not working" New topic
Author

setRollbackOnly not working

Roshan Lal
Ranch Hand

Joined: Nov 13, 2001
Posts: 64
I have a stateless session bean. In that one method calls two other methods of this bean. In those two methods they do call local entity beans for insert.
In the second call's catch block I have set ctx.setRollbackOnly().My second call to throws an exception.
I was expecting since the second call to entity bean threw an exception, and I marked the transaction to rollback, the entire transaction will rollback.
All the methods have been marked with "Required" attribute.
I am using weblogic 6.1.
Please help
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
Are you using a TXDatasource?
Chris Mathews
Ranch Hand

Joined: Jul 18, 2001
Posts: 2712
BTW, this is more of a WebLogic specific issue then a general J2EE question, as far as I can see, and should probably be moved to the WebLogic Forum.
Roshan Lal
Ranch Hand

Joined: Nov 13, 2001
Posts: 64
Thanks for reply Chris. No , I am not using TxDatasource. I am using Datasource. Would it matter if only single database is involved because I thought TxDatasource is for 2PC?
Also , I have printed the transaction id
(using weblogic.transaction.TxHelper.getTransaction().getXID())in stateless session bean method and the entity bean methods. All methods print the same xid.
Originally posted by Chris Mathews:
Are you using a TXDatasource?

[ January 24, 2003: Message edited by: Roshan Lal ]
Roshan Lal
Ranch Hand

Joined: Nov 13, 2001
Posts: 64
Thanks a lot Chris. I tried TXDatasource and it works! I will read more on TXDatasource now...
Originally posted by Chris Mathews:
Are you using a TXDatasource?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setRollbackOnly not working
 
Similar Threads
488/158 ICE questions & 488/155 resources page
Exception
Transactions & Exception doubt 2
Transaction-propagation
whereto use setRollbackOnly