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

From: Marcin Skladaniec (poldwusmoko..mail.com)
Date: Sat May 20 2006 - 03:00:38 EDT

  • Next message: Tomi NA: "Re: serialization issue"

    Hm. Strange. I do really complex commits, sometimes 7 or more related
    records (I mean 7 levels of relationship, not seven entities),
    related by many-to-many many-to-one relationships and never get those
    problems. And it doesn't matter if the records are new or old. Could
    you describe how you are creating objects and how do you commit them ?

    Regards
    Marcin

    On 20/05/2006, at 4:31 PM, Tomi NA wrote:

    > 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 - 03:01:11 EDT