Valid 1Z0-895 Dumps shared by ExamDiscuss.com for Helping Passing 1Z0-895 Exam! ExamDiscuss.com now offer the newest 1Z0-895 exam dumps, the ExamDiscuss.com 1Z0-895 exam questions have been updated and answers have been corrected get the newest ExamDiscuss.com 1Z0-895 dumps with Test Engine here:
A stateful session bean needs to restore its conversational state to its initial state if the transaction in which the bean is participating rolls back. Which bean method can be used to do this?
Correct Answer: C
Explanation/Reference: The afterCompletion method notifies a stateful session bean instance that a transaction commit protocol has completed, and tells the instance whether the transaction has been committed or rolled back. Returns: True if the current transaction is marked for rollback, false otherwise. Incorrect answers: A: getRollbackOnly() tests 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. B: Obtain the transaction demarcation interface. Only enterprise beans with bean-managed transactions are allowed to to use the UserTransaction interface. As entity beans must always use container-managed transactions, only session beans or message-driven beans with bean-managed transactions are allowed to invoke this method. Returns: The UserTransaction interface that the enterprise bean instance can use for transaction demarcation. Note: The SessionContext interface provides access to the runtime session context that the container provides for a session bean instance. The container passes the SessionContext interface to an instance after the instance has been created. The session context remains associated with the instance for the lifetime of the instance. D: beforeCompletion() The beforeCompletion method notifies a stateful session bean instance that a transaction is about to be committed. Reference: javax.ejb, Interface SessionSynchronization