nerdexam
Oracle

1Z0-898 · Question #5

A stateless session bean's business method invokes EJBContext.setRollBackOnly and receives an IllegalStateException. Under which of these conditions could this be possible?

The correct answer is B. The business method is marked with the NONSUPPORTED transaction attribute. void setRollbackOnly() throws java.lang.IllegalStateException Mark the 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…

Advanced Topics

Question

A stateless session bean's business method invokes EJBContext.setRollBackOnly and receives an IllegalStateException. Under which of these conditions could this be possible?

Options

  • AThe business method is marked with the MANDATORY transaction attribute.
  • BThe business method is marked with the NONSUPPORTED transaction attribute.
  • CThis Is NOT possible; a stateless session bean cannot invoke EJBContext.SetRollBackOnly.
  • DThe bean has no metadata (in annotations 01 deployment descriptor) which specifies the

How the community answered

(57 responses)
  • A
    4% (2)
  • B
    70% (40)
  • C
    9% (5)
  • D
    18% (10)

Explanation

void setRollbackOnly() throws java.lang.IllegalStateException Mark the 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. IllegalStateException - The Container throws the exception if the instance is not allowed to use this method (i.e. the instance is of a bean with bean-managed transactions).

Topics

#transaction management#NONSUPPORTED#setRollbackOnly#EJBContext

Community Discussion

No community discussion yet for this question.

Full 1Z0-898 Practice