Re: Delete rules on flattened relationships
Re: Delete rules on flattened relationships
- Subject: Re: Delete rules on flattened relationships
- From: Paul Hoadley <email@hidden>
- Date: Thu, 10 Nov 2011 10:38:57 +1030
On 10/11/2011, at 8:25 AM, Ramsey Gurley wrote:
>> 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!)
>
> I looked a second time. The cascade is actually on the non-class property. The flattened is nullify... so maybe it would work with no action. I'm not recommending anything, just noting something I saw which seemed odd.
Sorry, not trying to pin you down to anything! In my example above, because UserRole.role is Nullify, probably having User.roles set to Nullify would not make any difference. I would have to work a bit hard to contrive an example where it mattered. Say if UserRole.role was Cascade (obviously it wouldn't be)—then if User.roles was Nullify they would conflict, but if it was No Action, the Cascade would happen.
Obviously you could look at each flattened relationship on a case-by-case basis. I'm just trying to tease out whether No Action would be correct 100% of the time, as long as you had the right delete rules along the chain of actual relationships that constituted the flattened relationship.
--
Paul.
http://logicsquad.net/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden