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
This archive was generated by hypermail 2.0.0 : Fri Sep 16 2005 - 11:40:49 EDT