Home » Oracle » 1z0-898 » Which circumstance can this happen?
A session bean business method invokes UserTransaction.setRollbackonly and receives an IllegalStateException.
Under which circumstance can this happen?
A. The bean is using bean-managed transactions regardless of whether there is an active transaction.
B. There is no circumstance that would cause setRollbackOnly to throw an IllegalStateException.
C. The bean is using bean managed transaction demarcation, and UserTransaccion.begin has been invoked.
D. The setRollbackOnly method is invoked within a bean-managed transaction, and userTransaction.commit has NOT been invoked.
Correct Answer: A
Explanation/Reference:
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.
References:
Download Printable PDF. VALID exam to help you PASS.
|
|