Circle references

From: Andrey Razumovsky (razumovsky.andre..mail.com)
Date: Wed Apr 15 2009 - 08:37:27 EDT

  • Next message: Andrus Adamchik: "Re: Circle references"

    Hi,

    I've got three entities, A, B, and C and three to-one relationships (A->B,
    B->C, C->A). When I fire code like that:

    A a = context.newObject(A.class);
    B b = context.newObject(B.class);

    a.setToB(b);
    context.commitChanges();

    I *sometimes* get SQL exception at commit, saying that object in B does not
    exist when inserting A, i.e. Cayenne is insering records in wrong order.
    Seems that it just can't define order of commits because of circle
    references. Can I somehow help Cayenne solve this puzzle? (I think I can
    even sacrifice some of reverse (to-many) relationships.
    And what's the algorithm of sorting entities before commit?

    Thanks,
    Andrey



    This archive was generated by hypermail 2.0.0 : Wed Apr 15 2009 - 08:38:01 EDT