EJB3 Session Beans

I recently realized that a great source of confusion for me surrounding EJB session beans, especially stateful session beans, was “how are they associated with the session?” The answer: they aren’t! A new stateful session bean instance is created each time you request a reference to one. That’s the “session” – the time in-between requesting a reference to the bean, and when you derefernce the bean. There’s no implicit association with the HTTP session. If you want to associate it with the HTTP Session, do it yourself!


Comments are closed.

%d bloggers like this: