While excepting a business method in a stateless session bean the container rolls back the method’s transaction. Which three are possible causes for the container’s behavior? (Choose three.)
A.
The bean uses container-managed transactions and invokes EJBContext.setRollbackOnly.
B.
The bean uses container-managed transactions and invokes EJBContext.getRollbackOnly.
C.
The business method throws a java.lang.NullPointerException.
D.
The business method throws a checked exception of a class type that is marked with the @ApplicationException annotation with the rollback element value true.
E.
The business method throws a unchecked exception of a class type that is marked with the @ApplicationException annotation with the rollback element value true.
F.
The bean uses container-managed transactions and throws a checked exception of a class type that is marked with the @ApplicationException annotation
Suggested Answer:ADF🗳️
A: setRollbackOnly - 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. Note: * In a stateless session bean with bean-managed transactions, a business method must commit or roll back a transaction before returning. * Bean-Managed Transactions In bean-managed transaction demarcation, the code in the session or message-driven bean explicitly marks the boundaries of the transaction. Although beans with container-managed transactions require less coding, they have one limitation: When a method is executing, it can be associated with either a single transaction or no transaction at all. If this limitation will make coding your bean difficult, you should consider using bean-managed transactions. * (incorrect) Unchecked runtime exceptions represent conditions that, generally speaking, reflect errors in your program's logic and cannot be reasonably recovered from at run time. Incorrect:
B: getRollbackOnly - Test if the transaction has been marked for rollback only. An enterprise bean instance can use this operation, for example, to test after an exception has been caught, whether it is fruitless to continue computation on behalf of the current transaction. Only enterprise beans with container-managed transactions are allowed to use this method.
Currently there are no comments in this discussion, be the first to comment!
This section is not available anymore. Please use the main Exam Page.1z0-895 Exam Questions
Log in to ExamTopics
Sign in:
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.
Upvoting a comment with a selected answer will also increase the vote count towards that answer by one.
So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.
Comments