Re: Question about Core Data Inverse Relationships
Christiaan Hofman <[email protected]>
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sep 20, 2009, at 6:18, Bennett Smith wrote: > Well, I tried to attach the diagram, but guess the mailing list > strips it out. The jist of the diagram was that I have the > following entities: > > User > name > currentAttributes (to-many relationship with Attribute) > oldAttributes (to-many relationship with Attribute) > > Attribute > dateRecorded > name > value > user (relationship with User) > > The problem I'm having is with setting up the inverse relationship > in the Attribute entity. I would to specify an inverse relationship > for both currentAttributes and oldAttributes, but can't see how to > do this. > > Many thanks, and sorry for the confusion about posting the diagram. > > Cheers > > -- Bennett Plain logic tells you this is impossible. An attribute can be both an oldAttribute and a currentAttribute,so which user should be set in the user property? You should not have to ask this. So you'll have to change your model, and add another user relationship to use as the inverse of oldAttributes. Christiaan > > On Sep 19, 2009, at 9:14 PM, Bennett Smith wrote: > >> Forgot to attach the diagram: >> >> >> >> On Sep 19, 2009, at 9:09 PM, Bennett Smith wrote: >> >>> Hello >>> >>> I am stuck on a problem that I just can't figure out. I am very >>> new to Core Data so it might just be that I am going about this >>> wrong. I want to setup a model for something like this: >>> >>> >>> The currentAttributes and oldAttributes relationships in User are >>> configured as "to-many relationships." My problem is in figuring >>> out how to set an inverse relationship in the Attribute class. It >>> seems like I cannot have an inverse relationship that points back >>> to User for all Attribute entities in this case. (At least I can't >>> figure out how to do it in Xcode.) >>> >>> The purpose for this model is to allow me to track a set of >>> attributes associated with a user and to keep track of any changes >>> in the attribute values over time. A change is defined as >>> replacing the value associated with the attribute or deleting an >>> attribute. I am open to other suggestions on how to achieve this >>> goal using Core Data. >>> >>> Thanks >>> >>> -- Bennett >>> _______________________________________________ >>> MacOSX-dev mailing list >>> [email protected] >>> http://www.omnigroup.com/mailman/listinfo/macosx-dev >> >> _______________________________________________ >> MacOSX-dev mailing list >> [email protected] >> http://www.omnigroup.com/mailman/listinfo/macosx-dev > > _______________________________________________ > MacOSX-dev mailing list > [email protected] > http://www.omnigroup.com/mailman/listinfo/macosx-dev