Re: Share datacontext between users?

From: Twan Kogels (twa..wansoft.com)
Date: Wed Sep 14 2005 - 04:35:02 EDT

  • Next message: Cris Daniluk: "Re: Clearing query cache on commit"

    Hello Robert,

    Thanks for the reply, it was indeed a really stupid mistake of me. I
    already thought "why did it work in other webapps and why isn't it working
    in this webapp?" ;-)

    Twan

    At 15:32 12-9-2005, you wrote:
    >DataContext.commitChanges() will propagate the
    >changes across the data contexts. I doubt this
    >is an issue with the data context; it's more likely
    >that you're caching the list somewhere and not
    >refetching the list from the data context.
    >I'd check your code first to make sure this isn't happening. :)
    >
    >Robert
    >
    >Twan Kogels wrote:
    > > Hello all,
    > >
    > > Last week i bumped into a strange behaviour. I have a webapp which
    > > allows users to login, when a user is logged in he can modify a list of
    > > items. Now 2 users login, a WebApplicationListener assigns a DataContext
    > > to the Session. I get the datacontext when i need to do a query by
    > > calling :
    > >
    > > DataContext ctxt =
    > > BasicServletConfiguration.getDefaultContext(request.getSession());
    > >
    > > So this means if i understand the documentation right that each user get
    > > a different DataContext.
    > >
    > > User 1 logs in, User 2 logs in.
    > > Now User1 deletes a Item, let's say item1. User1 views the list of items
    > > and sees that item1 is deleted.
    > > 5 seconds later User2 views the list and item1 is still there. User2
    > > tries to delete item1 but this causes a exception cause User1 has
    > > already deleted item1.
    > > If User2 logs out and logs in again (new session created), and views the
    > > list then item1 is gone.
    > >
    > > I think the problem lies in the way i set or retrieve the datacontext.
    > >
    > > Is there a way to let users share a DataContext so that they will see
    > > each other actions? Or is it maybe something different?
    > >
    > > Kind regards,
    > > Twan
    > >
    > >
    > >



    This archive was generated by hypermail 2.0.0 : Wed Sep 14 2005 - 04:54:37 EDT