• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Transaction Attribute & Rollback Question

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Everybody's invited. Except this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic