On Oct 17, 2008, at 5:57 AM, Jean-Sébastien Scrève wrote:
Hi all,
I'd like to remove stateful sessions beans by calling a method from
OpenEJB
itself and I don't see how I can do that.
I don't want to call a method with @Remove annotation because I did
not
create the stateful myself.
Is there a way I can do that ?
More generally, how I can interact with the container at runtime ?
If the bean had a 2.x home/remote interface that'd be easy as you
could call remove on the home interface and pass in the stateful bean
reference. Aside from that, not sure it can be done. The code we
have for removing stateful beans is very much tied to the invoking of
the remove method, calling the predestroy methods of the interceptors
and bean, taking care of the transaction settings for the method,
handling the exceptions thrown from the method, etc. We don't have a
second way to remove stateful beans.
The only other way I can think of is via an interceptor. If an
interceptor method throws a runtime exception then the bean is
destroyed.
-David