Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HFE page 567-5

 
bird cao
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why?
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If methodA has a transaction attribute of RequiresNew, Never, or NotSupported, then it will not use an existing transaction of the calling methodB. MethodB only cares about a TransactionRolledbackException if its transaction is rolled back. In the above cases, methodB will not care about the status of methodA's transaction (if it is running in one).
If methodA has a transaction attribute of Madatory, then it must run in methodB's existing transaction. If methodA throws a system exception, the container will automatically roll back the transaction started by methodB. MethodB definitely cares about this and so it will receive a TransactionRolledbackException.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!