• 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

Why "Supports" is not supported in getRollbackOnly()

 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While reading through the Transactions chapter of Head First EJB , I read that getRollbackOnly() only supports the following Transaction Attribute :

1) Required
2) RequiresNew
3) Mandatory

For "NotSupported" and "Never" , I understand that getRollbackOnly() should not be supported as transaction is not supported by these attributes, but it should be supported for "Supports".

And support of "Mandatory" attribute even drills more my mind why "Supports" is not supported as the difference between "Supports" and "Mandatory" is the only difference of the exception thrown by "Mandatory".

Thanks
 
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi Tanu,

I guess you are referring to page 500, first of the 3 blocks, right?

With "Supports" you are not sure if you are in a transaction.
(you will only be in a transction if the caller already is in a transaction)

With "Requires", "RequiresNew" and "Mandatory" you are always in a transaction, therefore getRollBackOnly() is safe to use in these 3 cases.

OK?

Herman
 
reply
    Bookmark Topic Watch Topic
  • New Topic