RE: Caching problem

From: Fredrik Liden (flide..ranslate.com)
Date: Thu Apr 21 2005 - 13:22:58 EDT

  • Next message: Sami Mohammed: "Null Pointer error"

    That seems to be what's happening, changes not propagating back to the
    shared one (even though the changes are made to the database).
    I don't know that I'm using some shared DataContext though.
    It's a webapp and I'm using the listener to get the Context and then
    getting the context from the session for each request.

    Is is possible that a call to
    BasicServletConfiguration.getDefaultContext(request.getSession()); where
    the session is not valid would create a new temporary DataContext?
    Using BasicServletConfiguration.getDefaultContext(request.getSession());
    is the same as getting it for the first request and then specifically
    store it in the session with a setAttribute right?

    Also I'm doing a lot of in-memory queries on the object in question.
    Could is posssible that this could affect the propagation somehow?

    Fredrik

    -----Original Message-----
    From: Mike Kienenberger [mailto:mkienen..laska.net]
    Sent: Wednesday, April 20, 2005 7:39 PM
    To: cayenne-use..bjectstyle.org
    Cc: Fredrik Liden
    Subject: Re: Caching problem

    Are you using some kind of shared or persistent DataContext when the
    user
    logs in, but using a temporary or throw-away DataContext when you
    perform an
    update? The shared one would load the data once the first time it was
    accessed, but the changes to the temporary one might not be set to
    propagate
    back to that shared one.

    -Mike

    Fredrik Liden <flide..ranslate.com> wrote:
    > I'm getting a weird caching error.
    >
    > One user logs in, updates data on an edit page, submits and everything

    > looks ok on the view page. At this point I looked in the database and
    > the new values are indeed there.
    >
    > BUT, then when the user logs out (and kills the session) and then logs

    > back in again, the view and edit page displays values that are old.
    > Way old.
    >
    > Does anyone have any ideas what's going on?
    > If I refetch the object every time I view it the error doesn't occur.
    > But it's a lot of information to be loaded over and over. So I prefer
    > not having to refetch it so often. Are there other errors than
    > validation errors that I need to check for while doing the commit? But

    > then why is the database updated but not the context, it seems that
    > once the user logs in the dataObject uses some old data that was
    > stored in the context.
    >
    > If anyone has any input I'd be thankful
    >
    > Fredrik
    >
    >
    >
    >
    > -----Original Message-----
    > From: Fredrik Liden
    > Sent: Wednesday, April 20, 2005 5:36 PM
    > To: cayenne-use..bjectstyle.org
    > Subject: Ordering of fields
    >
    >
    > Does the order of the dbfields in the Map.xml have to be the same
    > order as the fields appear in the actual database table? I'm getting
    > some strange errors.
    >
    > Thanks,
    > Fredrik



    This archive was generated by hypermail 2.0.0 : Thu Apr 21 2005 - 13:21:28 EDT