Re: Question about DataContext

From: Mike Kienenberger (mkienen..laska.net)
Date: Tue May 10 2005 - 14:26:48 EDT

  • Next message: Fredrik Liden: "RE: Question about DataContext"

    Fredrik Liden <flide..ranslate.com> wrote:
    > I'm just curious,
    > Is there any preference over calling the following line for every
    > request to various JSPs and Servlets compared to just calling it once
    > during login and then take that context and store it as a session
    > attribute?
    >
    > DataContext context =
    > BasicServletConfiguration.getDefaultContext(request.getSession());
    >
    > The reason I ask is that sometimes I need to clear out the context and
    > all the objects (say if a change was made to the underlying db). I'm
    > thinking the logout which invalidates the session would be a good place
    > for that. Or during the logout, should I just release all the objects in
    > the dataContext (if that's possible) ?

    By default, this value is already stored in the session as an attribute.
    BasicServletConfiguration.getDefaultContext() is just a convenience wrapper
    that takes care of storing the DataContext in your session. (Take a look at
    the source code).

    So it's automatically gone when the session is gone.



    This archive was generated by hypermail 2.0.0 : Tue May 10 2005 - 14:24:52 EDT