File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Question on EJBContext.getRollbackOnly() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Question on EJBContext.getRollbackOnly() " Watch "Question on EJBContext.getRollbackOnly() " New topic

Question on EJBContext.getRollbackOnly()

Prashant Neginahal
Ranch Hand

Joined: Sep 14, 2002
Posts: 77
Hi Guys,

What is wrong in invoking EJBContext.getRollbackOnly() method from a business method executing with the 'Supports' transaction attribute. It might have associated with the transaction.


Thanks, <br />Prashant<br />SCJP, SCBCD
Adri Smith
Ranch Hand

Joined: Jun 07, 2004
Posts: 76
Actually you cannot make a getRollBackOnly() call in a business method which has its transaction attribute set to "support" because you are never sure this method will be in a transaction. It can be in an "unspecified transaction context".

In general you can never call getRollbackOnly() in a business method which has its attribute set to supports, not supported, never. For this reason all the methods of a CMP must not have any methods with that kind of transaction attribute.

Prashant Neginahal
Ranch Hand

Joined: Sep 14, 2002
Posts: 77
Thanks Adri.
I agree. Here's the link:
subject: Question on EJBContext.getRollbackOnly()
It's not a secret anymore!