1Z0-898 · Question #26
A session bean business method invokes UserTransaction.setRollbackonly and receives an IllegalStateException. Under which circumstance can this happen?
The correct answer is A. The bean is using bean-managed transactions regardless of whether there is an active. SetRollbackOnlythrows anIllegalStateException: The Container throws the exception if the instance is not allowed to use this method (e.g. if the bean is a stateful session bean) Note:setRollbackOnlymarksthe current transaction for rollback. The transaction will become…
Question
A session bean business method invokes UserTransaction.setRollbackonly and receives an IllegalStateException. Under which circumstance can this happen?
Options
- AThe bean is using bean-managed transactions regardless of whether there is an active
- BThere is no circustance that would cause set Rollback Only to throw an IllegalStateException.
- CThe bean is using bean managed transaction demarcation, and uaerTransaccion.begin has been
- DThe setRollbackOnly method is invoked within a bean-managed transaction, and
How the community answered
(46 responses)- A85% (39)
- B4% (2)
- C2% (1)
- D9% (4)
Explanation
SetRollbackOnlythrows anIllegalStateException: The Container throws the exception if the instance is not allowed to use this method (e.g. if the bean is a stateful session bean) Note:setRollbackOnlymarksthe current transaction for rollback. The transaction will become permanently marked for rollback. A transaction marked for rollback can never commit. Only enterprise beans with container-managed transactions are allowed to use this method.
Topics
Community Discussion
No community discussion yet for this question.