Home » Oracle » 1z0-898 » Which of these conditions could this be possible?
A stateless session bean’s business method invokes EJBContext.setRollBackOnly and receives an IllegalStateException.
Under which of these conditions could this be possible?
A. The business method is marked with the MANDATORY transaction attribute.
B. The business method is marked with the NONSUPPORTED transaction attribute.
C. This Is NOT possible; a stateless session bean cannot invoke EJBContext.SetRollBackOnly.
D. The bean has no metadata (in annotations 01 deployment descriptor) which specifies the transaction attribute for the method.
Correct Answer: B
Explanation/Reference:
Explanation:
setRollbackOnly
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.
Throws:
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 beanmanaged transactions).
References:
Download Printable PDF. VALID exam to help you PASS.
|
|