Re: Duplicate instances of same object in single dataContext ?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Mon Sep 12 2005 - 16:07:47 EDT

  • Next message: Andrus Adamchik: "Re: Divide: invalid parent - Equal"

    >
    > UPDATE Lookup SET ID = 1 WHERE ID = 1;

    Hmm... this looks familiar. I vaguely recall a similar problem
    described on this list. I'd doublecheck the relationship mapping,
    including the underlying db relationship. "PK", "To Dep PK" and such.

    Andrus

    On Sep 12, 2005, at 10:11 AM, Damir Bijuklic wrote:

    > Hi.
    >
    > I have a wierd problem, so i would like to discuss it
    > with the memebers.
    >
    >
    > Is it possible to have two different object instances
    > in the same DataContext representing same row from the
    > database (same PK) ?
    > I thought not but i seem to have them.
    > One instance is fetched via to-one relationship of
    > parent object, while other is fetched via SelectQuery.
    >
    > I have verified with the debugger that both instances
    > point to the same DataContext.
    >
    > I have tried recreating db and object relationship,
    > and generated objects but the problem persists.
    >
    > When i try to commit changes to the database cayenne
    > saves the change to the master table and makes dummy
    > updates to the lookup table looking like this:
    >
    > UPDATE Lookup SET ID = 1 WHERE ID = 1;
    >
    >
    > I have another almost identical relationship with the
    > same creation and access patterns which is behaving
    > properly? And dozens more of simmilar situations all
    > working as expected.
    >
    >
    > I'm using tapestry with cayenne, with DataContext
    > inside visit.
    > I use both relationships inside PropertySelection
    > which i have fixed for now by implementing equals on
    > base object.
    >
    >
    >
    > ...
    >
    > Bah, quite a mail just to confirm i'm not
    > misunderstanding something. I'm using 1.2b4 version,
    > i'm going to try to use latest version or CVS snapshot
    > and see...
    >
    >
    > Damir



    This archive was generated by hypermail 2.0.0 : Mon Sep 12 2005 - 16:07:49 EDT