Re: New objects break FK constraints

From: Andriy Shapochka (ashapochk..otmail.com)
Date: Fri Jan 30 2004 - 10:18:00 EST

  • Next message: Fernando Donati: "Cayenne, Tapestry, Spindle and Jetty Launcher"

    >
    > Can the order of insertion be done by analyzing the objects themselves
    > instead of the table schemas?
    >
    > Jim
    > --
    > Jim Menard, jim..o.com, http://www.io.com/~jimm/
    > "If at first you don't succeed, don't go skydiving." -- Unknown
    >
    >

    In principle, not talking about the current state of affairs in Cayenne,
    this is perfectly doable. Objects and relationships between them or rather
    data rows and fk-pk db relationships form a directed graph in memory and so
    the topological sorting is applicable to it just like it is to the graph of
    the corresponding db-entities. I should mention here, we based the
    insert/delete ordering algorithm on the topological sorting implemented in
    my library "Ashwood". Furthermore, applied to the data rows themselves, this
    approach would provide a kind of ultimate solution in the sense if the graph
    of data rows could not be resolved relatively to the referential integrity
    constraints this would mean either an application developer did make a
    logical error manipulating with the data in memory or the deferred
    constraints had necessarily had to be introduced.

    Of course going into such fine-grained data row based analysis should imply
    quite a bit of additional CPU and memory usage during the commits (Cayenne
    would have to build a graph of data rows and do the topological sorting
    every time one wants to commit the data). But in some cases like yours this
    feature might prove good to have in Cayenne. To sum up, the coarse-grained
    algorithm implemented in Cayenne was an absolute must to have to deal with
    any non-trivial schemas but we did not advance further due to the lack of
    time and manpower rather than the fundamental impossibility. Any
    hand-lending on this thing would be greatly appreciated.

    Andriy.



    This archive was generated by hypermail 2.0.0 : Fri Jan 30 2004 - 10:15:02 EST