Re: Comparing Current Snapshot and Committed Snapshot

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Tue Apr 26 2005 - 13:58:57 EDT

  • Next message: Colin Surprenant: "Re: The right tool for integration to existing DB"

    >
    > For example, I have a Player entity that has an optional to-one
    > relationship to Country called 'nationality'.
    >
    > When setting this relationship (when it was previously null)
    > createDiff() returns null...
    >
    > >>>> diff: null

    This is what I meant when I mentioned the "reverse diff"... "createDiff"
    method was done to be as fast as possible, so it makes a few assumptions
    about the two snapshots, namely if a key is missing in the snapshot whose
    method is invoked, but exists in another snapshot, this is not detected. I
    guess we should change that and make it consistent.

    > Inversely, changing or nullifying the relationship does return a diff...
    >
    > >>>> diff:
    > org.objectstyle.cayenne.DataRo..260a6[version=-9223372036854774684,
    > replaces=-9223372036854775808, values={NATIONALITY=null}]

    This looks right to me - it shows that the new NATIONALITY is NULL.

    I guess we can create a more specialized data structure that stores the
    key, the old value, and the new value. But the "diff" functionality can be
    a good starting point for that.

    Andrus



    This archive was generated by hypermail 2.0.0 : Tue Apr 26 2005 - 13:58:59 EDT