• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Bear Bibeault
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • salvin francis
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Frits Walraven
Bartenders:
  • Jj Roberts
  • Carey Brown
  • Scott Selikoff

dumb question about transactions

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What happens in the following scenario?

Method bar() of BMT bean1 starts transaction(tx A)
bar() calls method foo() on CMT bean2
foo() marks tx A for roll back by calling EJBContext.setRollbackOnly()
foo() returns
bar() calls commit() on tx A (suppose bar() didn't check if the tx was marked for rollback by foo())

Does bar() throw RollbackException or any other exception?
I hope the question made some sense.
Thanks,
 
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When commit is called for a Transaction that has been marked for rollback, the transaction will be rolled back and then a RollbackException will be thrown. So, foo will throw a RollbackException. Also note that if an XA transaction is involved, you might get a HeuristicMixedException or HeuristicRollbackException instead of the RollbackException
 
We noticed he had no friends. So we gave him this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic