the lookup should create a new instance but if you have the @EJB and
then you lookup it will fail cause will resolve the @EJB reference
Romain Manni-Bucau
Twitter: @rmannibucau
Blog: http://rmannibucau.wordpress.com/
LinkedIn: http://fr.linkedin.com/in/rmannibucau
Github: https://github.com/rmannibucau



2014-01-30  <[email protected]>:
> Hi Romain,
>
>
>> Lookup the stateful instead of injecting it (removing @ejb is important)
>
>
> The EJB SPEC states this would work the way I want?
>
> I never tried this on TomEE (I will), but on JBoss AS 7 / EAP 6 it won't
> work: a JNDI lookup throws the same exception as @EJB injection.
>
>
> []s, Fernando Lozano
>
>
>>
>> Le jeudi 30 janvier 2014, <[email protected]> a écrit :
>>
>>> Hi Romain, [about not being able to get a new instance of a SFSB after
>>> the original one was destroyed by timeout]
>>>
>>>> because it would be inconsistent. If you use a statetful it means you
>>>> need a state so if you have a new instance you loose your state
>>>
>>> But if (when) I really WANT a new instance? The same business process
>>
>>
>> could be
>>
>>> instantiated many times by the same user. Maybe not in parallel, but
>>> one
>>
>>
>> after another.
>>
>> discarded.
>>
>>> During EJB 2.x days, I could call create() many times for the same
>>> SFSB,
>>
>>
>> from the same web session. But with EJB3.x I can't find a way to create
>> my
>> SFSB instances. Be it using annotations or JNDI lookups, I get a new
>> instance the first time, and after timeout or after I explicit call a
>> "destroy" method, I cannot get another new instance.

Reply via email to