posted 19 years ago
The setRollbackOnly method only works in a transaction. If you fail to specify <trans-attribute>Required</trans-attribute>, the container will assign a default value, maybe NotSupported. In other words, the method will run in an unspecified transaction context which in your case means not running in a transaction. If the caller is part of a transaction, then the caller's transaction is suspended. If the EJB method fails, there will be no effect on the caller's transaction, and no rollback will occur.
Your case is a good example why transaction attributes must be specified for the appropriate methods of a CMT bean, as you may otherwise get an unwanted default attribute.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3