• Post Reply Bookmark Topic Watch Topic
  • New Topic

RequiresNew and Nested Transactions  RSS feed

 
Hussein Baghdadi
clojure forum advocate
Bartender
Posts: 3479
Clojure Mac Objective C
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.
AFAIK, EJB doesn't support "Nested Transactions".
But can we employ "Required" and "RequiresNew" transaction attributes
togehter to achieve the same effect of nested transactions?
Thanks.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36453
459
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
John,
In theory, that should work perfectly. In practice, it works sometimes. In particular, some app servers decide that if both transactions use the same connection object they should "optimize" things and merge the transaction. You will need to test it out on your app server to be sure.
 
Mike Keith
author
Ranch Hand
Posts: 304
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi John,

The JEE RequiresNew transaction attribute is actually slightly different from the traditional nested transaction. It suspends the original transaction and starts a new independent top-level transaction, so that if an original Required transaction rolls back a committed RequiresNew transaction will still be persisted. The other 3 scenarios of the two transactions being committed/rolled back is the same as with a nested transaction, though.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!