Re: Problems understanding delete behavior

From: Mark Evenson (evenso..anix.com)
Date: Wed Dec 10 2003 - 03:53:35 EST

  • Next message: Tore Halset: "Re: prefetching"

    Andrus Adamchik <andru..bjectstyle.org> writes:

    > > Is my code correct for performing deletion? Why is the deleted
    > > TestGroup
    > > being returned at all? Isn't this rather inconvient to have to check
    > > returned objects to see if their status is TRANSIENT or not? Do we
    > > have to
    > > explicity call both:
    > >
    > > group.removeFromTestSubjectArray(subject);
    > > dataContext.deleteObject(subject);
    > >
    >
    > Hi Mark,
    >
    > Try setting delete rule for to-one ObjRelationship from TestSubject to
    > TestGroup as "NULLIFY" in the Modeler. This should take create of the
    > problem, and the first line in the code above can be removed.
    >

    Setting the TestSubject --> TestGroup delete rule to "Nullify" does indeed
    prevent the TestGroup object from being returned when navigating from the
    TestCategory, which is the behavior I want. THanks

    My lack of expereience with Object Relational mappings is showing here, but
    my next question is why this would not be the default behavior for a system
    such as Cayenne?

    Naievely trying to set all my delete rules to "Nullify" when I set a toMany
    relationship's delete rule to "Nullify", I get two identical warning
    messages from the modeler about "ObjRelationship XXX has a Nullify delete
    rule and a mandatory reverse relationship" on saving the project. This is
    confusing as all of my relationship have teh "Update Reverse" box checked,
    but as to how they are "mandatory reverse relationship" is unknown.

    Is there some fuller explanation of what the various delete rules mean?
    I supposed "Cascade" is like a SQL constraint "ON DELETE CASCADE", but
    having a fuller explanation would be helpful.

    Thanks again.

    -- 
    Mark Evenson <evenso..anix.com>
    

    "A screaming comes across the sky. It has happened before, but there is nothing to compare to it now."



    This archive was generated by hypermail 2.0.0 : Wed Dec 10 2003 - 03:54:54 EST