Re: Delete cascade problem

From: Gili (cowwo..bs.darktech.org)
Date: Fri Sep 16 2005 - 11:57:54 EDT

  • Next message: Cris Daniluk: "Re: Delete cascade problem"

            I'm setting DENY in the modeler. What I am trying to communicate to
    Cayenne is that it is all right to delete(Master) -- this should trigger
    the deletion of all children -- but it is not alright to delete(Child).

            If I have:

    - A -> B -> C (cascading delete)
    - C is set to DENY if any instances of A are referencing it
    - User deletes A

            then I expect it to work because A is saying "I'll delete my reference
    to C if it'll let me delete it" and that should be quite all right.

    Gili

    Cris Daniluk wrote:
    > On 9/15/05, Gili <cowwo..bs.darktech.org> wrote:
    >
    >>Hi,
    >>
    >> I've got this relationship:
    >>
    >>On delete of A, cascade to B
    >>On delete of B, if any "A" instances exist, DENY
    >>
    >> What I'm seeing at runtime is that I delete A, it tries to cascade to B
    >>but this fails because A is still associated with it. Cayenne doesn't
    >>seem to be smart enough to notice this is ok because A is the one
    >>triggering the delete in the first place. Here are the logs I get at
    >>runtime (I added these to the code):
    >
    >
    > When you say DENY, are you referring to how you have it set up in the
    > Modeler, or in the database? Are you sure you don't mean to have "No
    > action"?
    >
    > If you use a master/child relationship, it sounds like you're doing:
    >
    > delete(Master) => delete(Children)
    >
    > delete(Child) => deny
    >
    > But that doesn't make a whole lot of sense... alternatively, you might be doing:
    >
    > delete(Child) => delete(Master)
    >
    > delete(Master) => deny if children
    >
    > Again, not making a whole lot of sense to me. I am probably not quite
    > getting what you're trying to do here, but it sounds like Cayenne is
    > doing the right thing. You generally want to pair a cascade and no
    > action, not a cascade and deny.
    >
    > Cris
    >

    -- 
    http://www.desktopbeautifier.com/
    



    This archive was generated by hypermail 2.0.0 : Fri Sep 16 2005 - 11:57:55 EDT