Re: Relationships between different DataContexts

From: Holger Hoffstätte (holge..izards.de)
Date: Thu Nov 28 2002 - 12:29:30 EST

  • Next message: Craig Miskell: "Rollback/revert in DataContext"

    Craig Miskell wrote:
    > solution at best). But I do think (and i think this is what you were
    > proposing Holger), that we can give a more intelligent error message.

    My thoughts, yes. It's futile to fight unsolvable problems, but at least
    we can try to catch them as early as possible.

    > It's easy enough caught when adding the object to the relationship, and
    > the cost is minimal: DataContext accessor for the base object,
    > dataContext accessor on the related object, and a literal comparison
    > (==).
    > And that's the best time to catch it, both from a long term consistency
    > (no odd errors slightly later when other assumptions are invalid), and
    > no error message at save time. If we throw an CayenneRuntimeException
    > (not a bad idea, IMHO), then the programmer has immediate feedback and a
    > stack trace to the line of code that is the root cause of the problem.

    Yes, looks right. I was first worried about adding things directly to the
    relationship array (while thinking about ordered relationships), but since
    it's a ToManyList and these know their owner by ObjectId we can have the
    check in there, too.
    I'll open a feature request on this.

    -h



    This archive was generated by hypermail 2.0.0 : Thu Nov 28 2002 - 12:29:56 EST