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?
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
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.