Re: Re: DataContext problem?

From: m..scensys.de
Date: Fri Apr 18 2003 - 09:28:01 EDT

  • Next message: Holger Hoffstätte: "Re: DataContext problem?"

    Arndt Brenschede <a..iamos.de> schrieb am 18.04.2003, 13:39:16:
    > Michael Schuldt wrote:
    > > Hi,
    > >
    > > in my web-application I'm using a DataContext for each session. When I'm
    > > creating new objects or updating existing ones and commting them to the
    > > database everything's ok. I can see the changes or the new Objects by
    > > reading them again through a query with the same DataContext.
    > > But the problem is with other sessions. I can't read the changes or the new
    > > objects commited fromout the other session from the database. There are only
    > > the old ones. But when I'm creating a new session, I can see everything!
    > >
    > > Any suggestions? It's very urgent.
    >
    > Well, what you describe is what you should expect (?) ...
    >
    > Sounds like you are using the DataContext with
    > session-lifetime, not request-lifetime, do you?
    >
    > So this DataContext works like a cache, and
    > you don't get notified if an object changes in
    > the Database.
    >
    > Could you describe your architecture some
    > more? If this "session-lifetime-d" DataContext
    > is by intention and you rely on this caching,
    > then you might have a real problem.
    >
    > Otherwise, you could think of using
    > short-lived (=request lifetime) DataContext's

    Sounds good.
    Yes, I'm using the DataContext in a session-lifetime.

    I tried to get the DataContext in every ActionClass by using:

    DataContext ctxt = ServletConfiguration.getDefaultContext(session);

    But nothing changed. The DataContext is still caching!

    Maybe it's a very dumb question but how can I use the DataContext in
    such a short lifetimed way like you described?

    Thanks you

    Michael

    >
    > Regards,
    >
    > Arndt



    This archive was generated by hypermail 2.0.0 : Fri Apr 18 2003 - 09:35:36 EDT