uCosminexus Application Server, EJB Container Functionality Guide

[Contents][Glossary][Index][Back][Next]

4.3.2 Precautions during the implementation of a Stateful Session Bean

This subsection describes the precautions to be taken when implementing a Stateful Session Bean.

Organization of this subsection
(1) Deleting the EJB instances and releasing the references with either the remove method or a method in which the @Remove annotation is specified
(2) Precautions about sharing of Bean classes
(3) Precautions concerning destruction of SessionSynchronization instances
(4) About invocation of the begin method of javax.transaction.UserTransaction with the setSessionContext method
(5) About invocation of an Enterprise Bean from the afterCompletion method

(1) Deleting the EJB instances and releasing the references with either the remove method or a method in which the @Remove annotation is specified

(2) Precautions about sharing of Bean classes

Do not use the same Session Bean as a Stateful Session Bean and Stateless Session Bean in the same J2EE application.

(3) Precautions concerning destruction of SessionSynchronization instances

If a system exception occurs during the beforeCompletion and afterCompletion method of SessionSynchronization, the instances of the corresponding Session Bean will not be destroyed in the EJB container.

(4) About invocation of the begin method of javax.transaction.UserTransaction with the setSessionContext method

The setSessionContext method of the Stateful Session Bean is used for invoking the begin method of javax.transaction.UserTransaction. However, according to the EJB specifications, you cannot use this method after invocation. Do not invoke the begin method of javax.transaction.UserTransaction.

(5) About invocation of an Enterprise Bean from the afterCompletion method

When you invoke another Enterprise Bean from the afterCompletion method of the Stateful Session Bean, the following operation will be performed depending on the operation mode of the J2EE server mode:

According to the EJB specifications, you cannot invoke another Enterprise Bean from the afterCompletion method of the Stateful Session Bean. Do not invoke another Enterprise Bean.