• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Delete rules on flattened relationships
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Delete rules on flattened relationships


  • Subject: Re: Delete rules on flattened relationships
  • From: David Avendasora <email@hidden>
  • Date: Thu, 17 Nov 2011 13:58:17 +0800

On Nov 17, 2011, at 1:40 PM, Paul Hoadley wrote:

> On 17/11/2011, at 2:54 PM, David Avendasora wrote:
>
>> On Nov 17, 2011, at 7:48 AM, Paul Hoadley wrote:
>>
>>> On 17/11/2011, at 10:08 AM, David Avendasora wrote:
>>>
>>>> On Nov 10, 2011, at 5:34 AM, Paul Hoadley 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.
>>>>
>>>> Wait. "Also"?!? That's insane. That's two distinct relationships representing the same DB information, and one is hiding a huge piece of the action. You are just asking for trouble.
>>>
>>> User.userRoles is not a class property.  All that's exposed is the flattened User.roles.
>>
>> Okay, then that should be alright then, and I think nullify is the proper setting for the non-class "real" relationships.
>
> (I think I've now officially confused everyone, and kind of regret starting this thread...)  No, you want Cascade on the non-class "real" relationships (to remove the row in the join table), and Nullify on the flattened relationship—as Chuck noted, to remove the destination object from the flattened relationship.

Ahg! I was meaning nullify on the the UserRole.user and UserRole.role relationships. The User.userRoles() and Role.userRoles() should be cascade, owns and propagate PK. The User.roles(), Role.users() relationships … well, I'll take your word for it. Especially seeing as how you went and tested it. :-)

>>> I don't _think_ I'm talking about anything particularly unusual here, just the standard result of creating a many-to-many relationship with Entity Modeler, with a join entity and "Flatten relationships" checked.
>>
>> Not unusual, just something that you really shouldn't even be thinking about.
>
> Point taken, though someone has to think about it at some point.  I thought the default delete rule (Nullify) was wrong.  Turns out I was incorrect.  :-)

But if you didn't flatten the relationship it wouldn't have been there to think about. That's what I'm trying to say. Flattening doesn't save time / work / grief, it just shifts it.

Dave _______________________________________________
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

References: 
 >Delete rules on flattened relationships (From: Paul Hoadley <email@hidden>)
 >Re: Delete rules on flattened relationships (From: Ramsey Gurley <email@hidden>)
 >Re: Delete rules on flattened relationships (From: Paul Hoadley <email@hidden>)
 >Re: Delete rules on flattened relationships (From: David Avendasora <email@hidden>)
 >Re: Delete rules on flattened relationships (From: Paul Hoadley <email@hidden>)
 >Re: Delete rules on flattened relationships (From: David Avendasora <email@hidden>)
 >Re: Delete rules on flattened relationships (From: Paul Hoadley <email@hidden>)

  • Prev by Date: Re: Delete rules on flattened relationships
  • Next by Date: Re: Delete rules on flattened relationships
  • Previous by thread: Re: Delete rules on flattened relationships
  • Next by thread: Re: Delete rules on flattened relationships
  • Index(es):
    • Date
    • Thread