nerdexam
Oracle

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…

Advanced Topics

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)
  • A
    85% (39)
  • B
    4% (2)
  • C
    2% (1)
  • D
    9% (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

#bean-managed transactions#UserTransaction#setRollbackOnly#IllegalStateException

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice