Hi Ramsey,

On 10/11/2011, at 4:24 AM, Ramsey Gurley wrote:

> On Nov 8, 2011, at 8:34 PM, Paul Hoadley wrote:
> 
>> So the advice is that the intended delete rule(s) should operate on the real 
>> relationship chain, not shortcut via the flattened relationship.  That's 
>> fine, but are Nullify and Do Nothing really interchangeable on a flattened 
>> relationship, as it's almost suggested above?  It's important because the 
>> default is Nullify, so all flattened relationships have that rule unless you 
>> change them.  But depending on whether that rule is applied before or after 
>> the rule(s) applied over the real relationship chain, Nullify might end up 
>> giving you the wrong semantics.  Shouldn't all flattened relationships have 
>> a Do Nothing delete rule (at least by default)?

> Not all... at least not flattened many to many.  Those cascade.  Which led me 
> to a surprising find as well.  The opposite side of that cascade is nullify, 
> which I thought was incompatible with cascade.  But, evidently, it works and 
> I can see why it would be needed on the other side of the delete.

Say I have two entities, User and Role, and a joining entity UserRole to create 
a many-to-many relationship between them.  So I have a relationship 'userRoles' 
from User to UserRole (and a relationship 'userRoles' from Role back to 
UserRole).  I flatten the relationship on User, so I also have a 'roles' 
relationship on that entity.

Say I delete a User.  I want User.userRoles to Cascade.  And I want both 
UserRole.user and UserRole.role to Nullify.  And at that point, isn't the work 
done?  So in this case, wouldn't I want No Action on User.roles?  And hence 
isn't this a counter-example to your advice above?  (It may well not beā€”tell me 
if I'm wrong!)


-- 
Paul.

http://logicsquad.net/


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to