Re: Parent/Child Insert ordering (was: Caching problem?)

From: Tomi NA (hefes..mail.com)
Date: Sat May 20 2006 - 02:31:38 EDT

  • Next message: Marcin Skladaniec: "Re: Parent/Child Insert ordering (was: Caching problem?)"

    On 5/20/06, Jeff de Vries <jdevrie..frog.com> wrote:
    > I don't know if it is related or not, but I've also had problems in the
    > past when I try to create a new parent and several child objects related
    > to that parent all at once and then try to commit. The problem looks
    > like Cayenne is INSERTing the child records into the database first,
    > before the parent record, and the database complains that the children
    > have an invalid foreign key (and, yes, I have the ON UPDATE and ON
    > DELETE rules for the foreign key set to DO NOTHING and I still get the
    > error from PostgreSQL). To get around it I just committed the parent
    > first, then committed all the children.

    I had the same problem, IIRC: I was very surprised that cayenne
    couldn't handle such a commit, although truth be told, I can't imagine
    everything that's going on under the hood of the operation that would
    make implementing this feature difficult.
    I would certainly love to see this fixed (if at all possible) as I
    wasn't to happy to have to commit in the middle of what had to be an
    atomic transaction. It'd also make the framework a lot more flexible,
    e.g. enabling the user to have long inter-commit sessions with complex
    data updates, if the user so desires.

    t.n.a.



    This archive was generated by hypermail 2.0.0 : Sat May 20 2006 - 02:32:05 EDT