• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Transaction Attribute & Rollback Question

 
michael schufer
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

If I have a session bean (A) calling 3 other methods in 3 other diffent session beans (B,C,D)
as follows with the transaction attributes:


A ---> B (Create, Transaction Attribute: Required)
---> C (Query, Transaction Attribute: Never)
---> D (Delete, Transaction Attribute: Required)

Question: If there's a failure in Sesssion Bean D, will the whole transaction be roll backed to B? Assuming that the context.setRollBackOnly method is being called in each of the catch method.
Thanks.
 
Shogo Ito
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume there is no transaction in A, otherwise A'll get an RemoteException calling C.

A calls B. B starts a transaction, say Tx-B, and completes (commit).
A calls C.
A calls D. D starts a transaction, say Tx-D, and rollbacks. This will cause only Tx-D to rollback, not Tx-B.

J2EE does not support nested transactions. If you want Tx-B to rollback as well, then you need to use "Required" in A and change "Never" to "NotSupported" in C.

No warranty on what you just read
 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic