Interview Questions

A stateful session bean implementing the SessionSynchronization interface is deployed on the WebLogic server ...

BEA WebLogic Questions and Answers


(Continued from previous question...)

A stateful session bean implementing the SessionSynchronization interface is deployed on the WebLogic server ...

A stateful session bean implementing the SessionSynchronization interface is deployed on the WebLogic server. Which of the following callback methods may be invoked on the bean?
a. beforeBegin
b. afterBegin
c. beforeCompletion
d. afterCompletion


Choices B, C and D are correct. A stateful session bean using container-managed transactions can implement the javax.ejb.SessionSynchronization interface to provide transaction synchronization notifications. This interface defines only 3 methods - afterBegin(), beforeCompletion() and afterCompletion().
The afterBegin() callback method is called when the bean becomes part of a transaction. It is called before the EJB Object delegates the business method invocation to the bean instance. If the transaction is committed, the bean will be notified through its beforeCompletion() method. If the transaction is rolled back, this method is not invoked. The afterCompletion() method is always invoked whether the transaction ended with a commit or a rollback. A is incorrect because beforeBegin is not a method defined in the SessionSynchronization interface.

(Continued on next question...)

Other Interview Questions