This content has been marked as final.
Show 4 replies
-
1. Re: Call SFSB from SLSB.
v.lukoyanov Nov 18, 2009 10:40 AM (in response to allanjun)It's not good in use SFSB from SLSB.
Quote from EJB3 in Action:
If you are using DI, make sure you don’t inject a stateful session bean into a stateless ses-
sion bean or servlet. Injected EJB instances are stored in an instance variable and
are available globally for subsequent clients even if a stateless bean instance is
returned to the pool, and an injected stateful bean instance may contain inaccu-
rate state information that will be available to a different client. It’s legal to inject
a stateful bean instance to another stateful session bean or an application client.----------
My seam website -
2. Re: Call SFSB from SLSB.
allanjun Nov 18, 2009 11:41 AM (in response to allanjun)
Vasilii L. wrote on Nov 18, 2009 10:40:
Injected EJB instances are stored in an instance variable and
are available globally for subsequent clients even if a stateless bean instance is
returned to the poolI see, that's how my example above worked. Didn't know it's available globally.
So, does that mean I need to change my ClientServiceBean to stateful?
-
3. Re: Call SFSB from SLSB.
allanjun Nov 18, 2009 11:45 AM (in response to allanjun)And I guess I need to call a @remove method when I'm done with the bean, otherwise, it's only destroyed when web session expired, right?
-
4. Re: Call SFSB from SLSB.
v.lukoyanov Nov 18, 2009 1:43 PM (in response to allanjun)
Allan Li wrote on Nov 18, 2009 11:41:
So, does that mean I need to change my ClientServiceBean to stateful?Yes, seems so.
And I guess I need to call a @remove method when I'm done with the bean, otherwise, it's only destroyed when web session expired, right?I'm not sure if web session lifetime is related to stateful ebj lifetime, but you definitely have to destroy your bean somehow.
----------
My seam website