Hello,

I guess there is an issue with the stateful container.
Actually, when a @Remove method is invoke, all attached persistence context
must be closed as per the spec.

*7.6.2 Container-managed Extended Persistence Context*

A container-managed extended persistence context can only be initiated
within the scope of a stateful

session bean. It exists from the point at which the stateful session bean
that declares a dependency on an

entity manager of type PersistenceContextType.EXTENDED is created, and is
said to be bound

to the stateful session bean. The dependency on the extended persistence
context is declared by means

of the PersistenceContext annotation or persistence-context-ref deployment
descrip-

tor element.

The persistence context is closed by the container when the @Remove method
of the stateful session

bean completes (or the stateful session bean instance is otherwise
destroyed).



*3.2.7 Detached Entities*

A detached entity results from transaction commit if a transaction-scoped
container-managed entity

manager is used (see section 3.3); from transaction rollback (see section
3.3.2); from detaching the

entity from the persistence context; from clearing the persistence context;
from closing an entity man-

ager; or from serializing an entity or otherwise passing an entity by
value—e.g., to a separate applica-

tion tier, through a remote interface, etc.


After checking the StatefulContainer, i saw the following comment  // todo
destroy extended persistence contexts
For the moment, Persistence Context are released but not closed.

I want to fix that, but would like to get your thoughts.
BTW, in the #removeEJBObject method, I guess I must close persistence
contexts after the afterInvoke method.

Jean-Louis

Reply via email to