Dear forum,
In the book by Floyd, EJB Design Patterns, there is a great emphasis on making sure to execute "ctx.setRollbackOnly()" in an EJB exception caught clause before re-throwing an app exception.
Is this strategy applicable to Container Managed Transaction?
Thank you.
- Simon
-
ctx.setRollbackOnly() should be called first? (3 messages)
- Posted by: Simon See
- Posted on: April 06 2003 21:20 EDT
Threaded Messages (3)
- ctx.setRollbackOnly() should be called first? by Kiran Kumar on April 07 2003 03:19 EDT
- ctx.setRollbackOnly() should be called first? by Gal Binyamini on April 07 2003 09:32 EDT
- ctx.setRollbackOnly() should be called first? by Bao Stone on April 13 2003 21:37 EDT
-
ctx.setRollbackOnly() should be called first?[ Go to top ]
- Posted by: Kiran Kumar
- Posted on: April 07 2003 03:19 EDT
- in response to Simon See
Yes, the strategy described above is also applicable for Container Managed Transactions. Infact by seeing the variable name 'ctx', I guess that the discussion was about CMT.
This is how you usually invoke 'setRollbackOnly()'
CMT
ejbContext.setRollbackOnly();
BMT
UserTransaction transaction = ejbContext.getUserTransaction();
transaction.rollback() (OR) transaction.setRollbackOnly(); -
ctx.setRollbackOnly() should be called first?[ Go to top ]
- Posted by: Gal Binyamini
- Posted on: April 07 2003 09:32 EDT
- in response to Simon See
Note that you dont have to do any of this if the exception is a system exception (i.e, not in the method's throws clause) and you are re-throwing it. In that case the container will rollback itself.
Gal -
ctx.setRollbackOnly() should be called first?[ Go to top ]
- Posted by: Bao Stone
- Posted on: April 13 2003 21:37 EDT
- in response to Simon See
Yes, this strategy can applicable to CMP. One more thing you need note if you are using Bea Weblogic Server, you must using Tx Data Sources to connect it.
BaoStone