• 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: Reflexive relationship with same relationship name?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reflexive relationship with same relationship name?


  • Subject: Re: Reflexive relationship with same relationship name?
  • From: Mike Schrag <email@hidden>
  • Date: Sun, 11 Jul 2010 19:41:48 -0400

I've never had a problem with this ... It should work exactly like a regular relationship with a join entity. We routinely had "category" entities with parent and children categories via a "categorystructure" join. Deeply nested structures are pretty tricky to query optimally, though, with the naive navigation. There's a fair amount written about modeling trees and graphs in a relational db that can be adapted for eof. If the structure is big, though, I would expect to write custom SQL.

Sent from my iPhone

On Jul 11, 2010, at 5:35 PM, Simon <email@hidden> wrote:

the short answer from our experience is that it's more pain than gain.

we model these kinds of relationships "manually" - for example, in a typically user1 to user2 relationship we have a user table, and a "link" table in which we store the pk of user1, and the pk of user2, but we only model the relationship for user1. we then have a method that fetches user2 on demand. if you model the user2 relationship things start to go nuts. if you need user2 also related to user1 then we create a second row in the link table for that relationship.

simon


On 10 July 2010 22:25, Joe Moreno <email@hidden> wrote:
Is it possible for EOF to support a reflexive relationship back to the same Entity with the same relationship property name through a flattened many-to-many?

Think of a User entity in the case of LinkedIn where users are "linked" to other users:
User <---->>Connection<<---->User

Connection is the flattened (EOGenericRecord) m:n table with only the foreign keys as its two primary keys. User.connections simply returns all the connected users.

I'm imagining that you'd link them up like this:
userA.addObjectToBothSidesOfRelationshipWithKey(userB, "connection");

Any one with experience/gotchas doing this? (No inheritance involved.)

Thanks,
Joe

_______________________________________________
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

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: 
 >Reflexive relationship with same relationship name? (From: Joe Moreno <email@hidden>)
 >Re: Reflexive relationship with same relationship name? (From: Simon <email@hidden>)

  • Prev by Date: Re: Reflexive relationship with same relationship name?
  • Next by Date: semi OT: converting strings to 80 column wide "pretty print"
  • Previous by thread: Re: Reflexive relationship with same relationship name?
  • Next by thread: semi OT: converting strings to 80 column wide "pretty print"
  • Index(es):
    • Date
    • Thread