This content has been marked as final.
Show 4 replies
-
1. Re: multiple @Remove, EJB3 incompatible?
pmuir Jan 9, 2008 8:07 AM (in response to sannegrinovero)"sannegrinovero" wrote:
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"
.
So, this is probably a bug with JBoss Tools.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?
Seam doesn't call the @Remove, the EJB container does - Seam asks for the Session to be destroyed, and the EJB container can act on it.
I'm quite confused by what you are saying, but what *happens* is this:
You call a method annotated @Remove, after the completion of the this method, the container destroys the SFSB, executing any callbacks (@Destroy methods are all registered as callbacks) before it does so.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?
No, Seam doesn't call methods @Remove, you docouldn't seam directly ask EJB to trigger destruction?
When?or have another annotation, an extension to @Remove, single on a bean, so to know which one to call?
Why? -
2. Re: multiple @Remove, EJB3 incompatible?
sannegrinovero Jan 9, 2008 8:24 AM (in response to sannegrinovero)thanks a lot Pete,
if you think it's a bug of the tools then all the rest of my confusion doesn't apply.
Still you saySeam doesn't call the @Remove, the EJB container does
That makes some confusion, I would say that the EJB containers calls the destroy, and not the remove: as you write later onNo, Seam doesn't call methods @Remove, you do
.
Still, isn't documentation wrong when it saysIn 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.
?
Why should Seam need a @Remove method? How does it identify the correct method when multiple methods are annotated? -
3. Re: multiple @Remove, EJB3 incompatible?
pmuir Jan 9, 2008 8:46 AM (in response to sannegrinovero)There is a bit of trickery here
If you define a method@Remove public void remove() {}
(method name doesn't matter)
then Seam assumes it is also the method to call for @Destroy. What happens if you have multiple methods marked @Remove with no parameters is the last one is taken as the @Destroy method. This is probably wrong. File a JIRA issue. -
4. Re: multiple @Remove, EJB3 incompatible?
sannegrinovero Jan 9, 2008 9:11 AM (in response to sannegrinovero)Thanks again,
here is the JIRA:
http://jira.jboss.org/jira/browse/JBSEAM-2475
Hope the documentation could be fixed too; I will do it myself if I manage to understand how it will be solved.