-
1. Re: Create stateless bean from stateful bean
jaikiran Dec 30, 2010 6:13 AM (in response to piotrekde)WorkerRemote r = // how to obtain reference? Should I use JNDI as ClientPOJO or @EJB annotation?
You can use @EJB injection since you are using it within another server side component (i.e. the @Stateful bean). However, that doesn't mean that you cannot use JNDI lookup. You can use JNDI lookup too, but @EJB injection is a convenient way of getting hold of the bean.
-
2. Re: Create stateless bean from stateful bean
piotrekde Dec 30, 2010 7:17 AM (in response to jaikiran)Thanks Jaikiran! I didn't know that @EJB gives reference backed by stateless beans pool - I thought that's just single stateless bean injection.
-
3. Re: Create stateless bean from stateful bean
jaikiran Dec 30, 2010 7:30 AM (in response to piotrekde)piotrekde wrote:
I didn't know that @EJB gives reference backed by stateless beans pool - I thought that's just single stateless bean injection.
Yeah, an @EJB internally injects a proxy similar to what you would have got when you do a JNDI lookup. And it's only when you invoke on that SLSB, that the instance association happens. It's the same irrespective of whether you use JNDI lookup or @EJB injection.