Hi, I am new to EJB. Can any body help me? If a session beans business method invokes, EJBContext.setRollBackOnly(),which transaction attribute settings can cause the container to throw the java.lang.IllegalStateException?
Container can Rollback only when business method is in transaction, but when transaction does not exist and trying to Rollback. It will always give java.lang.IllegalStateException. Because NotSupported , Supports, Never only these three transaction attribute allows a method call without existing a transaction.
Methods like setRollbackOnly or getRollbackOnly throw IllegalStateException if there is no Transaction Context. Supports, NotSoppurted and Never transaction attributes means there is not (or might not - for supports) a Transaction Context.
Generally method which should be called in a transaction context throw IllegalStateException when called from a method not executing in a transaction. This is the ground for the answers given
Regards, Leena [ March 11, 2005: Message edited by: Leena Diwan ]