1) I wrote a servlet which gives call to a BusinessDelegate to lookup EJBs (Stateless and Stateful both)
For stateless bean , I always get only one instance
for stateful, I always get a new instance.
Also, I am invoking some method on the stateless bean in loop. But the state of the bean is maintained across method calls.
I tried with @PostConstruct. It gets called only once.
For the stateful bean, I had written a @PostConstruct callback which gets called for every lookup. Posting that code below.
So was wondering why is it said that stateless beans dont maintain the state....
what makes stateful bean different than any other object which can be stored in session?