I didn't check it back but normally that's how stateful works normally since EJB 3.0
PS: EJB 2.0 can still be used if you want ;) 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, > > >> 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 > > > On JBoss, I tried using only lookup, no injection. > > But do you know lookup should solve by the spec, or is this just TomEE > implementation? I read the EJB 3 and 3.1 specs and could not find, but I can > guarantee I didn't missed something on such huge docs. > > > []s, Fernando Lozano > > >> >> 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 a >>>> >>>>> arded. During EJB 2.x days, I could call create() many times >>>> >>>> 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. > > >
