Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why "Supports" is not supported in getRollbackOnly()

 
tanu dua
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • 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
 
Herman Schelti
Ranch Hand
Posts: 387
  • Mark post as helpful
  • send pies
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic