File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Transaction Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Transaction" Watch "Transaction" New topic
Author

Transaction

Alibabra Sanjie
Ranch Hand

Joined: Feb 09, 2004
Posts: 147
The Container must throw the java.lang.IllegalStateException if the EJBContext.setRollbackOnly() method is invoked from a business method executing with the Supports, NotSupported, or Never (for MDB - ONLY with NotSupported) transaction attribute.

I don't why "...The Container must throw the java.lang.IllegalStateException..." If the method executed in a transaction context from the client, with the supports and NotSupported attributes, the container will throw IllegalStateException?


Alibabra
Joyce Lee
Ranch Hand

Joined: Jul 11, 2003
Posts: 1392
If the method executed in a transaction context from the client, with the supports and NotSupported attributes, the container will throw IllegalStateException?

Yes, you're right. It doesn't matter if the client is in a tranaction context while calling the bean's business methods, as long as the bean's business methods are set with Supports, NotSupported or Never attribute in DD, and the bean calls the Context.getRollbackOnly or Context.setRollbackOnly, the bean will receive illegalStateException thrown by the Container.
Note: Bean's business method with NotSupported attribute, will always be executed in unspecified transaction context.
Joyce
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
The transaction attributes Supports, NotSupported and Never do not require a transaction. Therefore, it seems reasonable to me that the invocation of any EJBContext method such as setRollbackOnly() must be regarded as illegal when the method is marked with any of these attributes and will result in java.lang.IllegalStateException being thrown by the container.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Transaction