Reference to Stateful Session Bean in HtttpSession Objec

Discussions

EJB design: Reference to Stateful Session Bean in HtttpSession Objec

  1. If a store a reference to a stateful session bean as an attribute of the HttpSession Object, will the reference still be valid after I getAttribute()? If not, how no make sure that I get the same session object? The specfic problem is I have a servlet that needs to create a statful
    session bean when the session is created. I need to access that same bean for all post to the servlet thereafter.
  2. you can very well go ahead and store the reference of ur stateful session bean in HttpSession and use like any other HttpSession object. the session will be available to u as long as the Http session lasts.

    kapil
  3. Are there an issues with clusters at the EJB layer? If the servlet server resides in a cluster, is there any machine specific data stored with the EJBobject reference stored in the HttpSession object?
  4. The session bean or the httpsession can time out?
  5. You need to be careful that the Stateful session bean doesn't time out before the HttpSession does. You should be able to configure the timeout time in the EJB, not sure about HttpSession though - I think you'll find it'll be application specific on both fronts.

    cheers
    dim