Re: Delete rules

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Sun Dec 03 2006 - 14:47:40 EST

  • Next message: Tore Halset: "Re: Delete rules"

    Just like with the outer joins discussion that you initiated some
    time ago, the answer here is that until a smart enough algorithm is
    designed to infer *correct* defaults for all combinations of
    relationships, Cayenne absolves itself from modifying the object
    graph, leaving it up to the user. Hence "No Action".

    On the other hand "Nullify", while not an ideal default, is probably
    the closest to "forcing [...] to consider [...] problem and solve it
    upfront" paradigm, as it will result in RuntimExceptions when used
    gratuitously. So maybe you are right about it.

    Anybody else has thoughts on that?

    Andrus

    On Dec 3, 2006, at 9:28 PM, Øyvind Harboe wrote:

    > I have discovered that I assumed that "Nullify" was default.
    >
    > Reading the wiki page below, I miss an explanation of why "No action"
    > is default or why "No action" exists at all. I would have preferred
    > some default that either "did what I expected" or forced me to
    > consider this problem and solve it upfront(the obvious cost being that
    > one is forced to learn another concept upfront).
    >
    > Can "No action" be overridden by subclassing to do something
    > reasonable?
    >
    > What worries me is that "No action" is a bug waiting to happen. It
    > certainly bit me(I've screwed this up in three Cayenne projects before
    > I learned of the the default delete rule). The precise behavior of "No
    > action" is somewhat random.
    >
    > - Delete + commit => relationship might exists depending on how many
    > objects are cached in Cayenne.
    > - Delete + commit + logout(create new DataContext) => relationship no
    > longer exists(same as above w/"Nullify")
    >
    > http://cwiki.apache.org/confluence/display/CAYDOC/Delete+Rules
    >
    > I was also somewhat surprised that validateForDelete() does not take
    > the deleteRule="Deny" into account and that the exception only occurs
    > when deleteObject() is invoked.
    >
    > --
    > Øyvind Harboe
    > http://www.zylin.com
    >



    This archive was generated by hypermail 2.0.0 : Sun Dec 03 2006 - 14:48:13 EST