Topic: Big doubt! Spec Page 361 -- IllegalStateException for Supports attribute.
posted 12 years ago
Hi All, I read Spec page 361: 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 transaction attribute.
Why there's exception for Supports Attribute? I understand, there's no transaction context for 'never' attribute, and unspecified transaction context for 'NotSupported' attribute, but method with 'Supports' attribute can have a valid transaction context (as long as the invoking method -- which invokes this 'Supports' attribute method -- has a valid transaction context, the 'Supports' attribute method will use this transaction context, so, the setRollbackOnly() can be invoked --- Why still IllegalStateException? Unless the invoking method has no valid transaction context, then the IllegalStateExceptionshould be thrown