[jboss-user] [JBoss Seam] - multiple @Remove, EJB3 incompatible?

sannegrinovero do-not-reply at jboss.com
Wed Jan 9 06:52:30 EST 2008

Hello everyone, I was thinking about Seam's use of the @Remove and @Destroy annotations,
I am wondering if Seam is imposing me some limitations on respect to EJB3 specs, or if I'm missing something.

from the Seam docs:
anonymous wrote : The @Destroy method is called when the context that the Seam component is bound to ends. Components may define only one @Destroy method...[...]
  | ...Destroy methods should be used only for cleanup.
anonymous wrote : The EJB standard @Remove annotation specifies that a stateful session bean should be removed and its state destroyed after invocation of the annotated method. In Seam, all stateful session beans must define a   method with no parameters marked @Remove. This method will be called when Seam destroys the session context.

Our application has some Stateful Beans with 1 single @Destroy and multiple @Remove; toying since some days JBoss Tools i get this error:
Duplicate @Remove method "methodname".

The applications actually looks-like working and I cant't tell if something bad is happening behind the scenes, but:
The warning from the tool makes sense as "This method will be called when Seam destroys the session context".. How could Seam know which method to call?

EJB3 uses the single @Destroy as a callback to cleanup, and is triggered by one of the @Remove; I think Seam is abusing this to call a @Remove (expecting it to be single) to trigger the EJB destroy.. is that right? couldn't seam directly ask EJB to trigger destruction? or have another annotation, an extension to @Remove, single on a bean, so to know which one to call?
I know I could avoid the need of multiple @Remove s with another design, but that's not the point.

Do I really need to remove the multiple "@Remove" from my beans? Does it really cause some trouble? I wouldn't like Seam spontaneously to call some of my annotated actions.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4118216#4118216

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4118216

More information about the jboss-user mailing list