• 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
Core Data warning: to-many relation does not have an inverse
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Core Data warning: to-many relation does not have an inverse


  • Subject: Core Data warning: to-many relation does not have an inverse
  • From: Nathan Vander Wilt <email@hidden>
  • Date: Wed, 10 Dec 2008 22:36:42 -0800

I'm trying to port my model code to use Core Data. My model is something like this:

I have a Company. It has two to-many relationships, currentEmployees and previousEmployees which are naturally both to Employees.

Employees have a to-one relationship to the Company that is the inverse of both the currentEmployees and previousEmployees. That is, the employee (records) belong to the Company regardless of current/ previous "status".

I also have a Consultant. It has a to-many relationship to interestingEmployees. Nobody talking to an Employee needs to have access to the Consultant, so there is no inverse relationship.


I have two problems with this model. When I compile it, I get a warning:

Consultant.interestingEmployees -- to-many relationship does not have an inverse: this is an advanced setting (no object can be in multiple destinations for a specific relationship)

This error doesn't make sense to me. Is it trying to say an object can only "belong" to one to-many relationship?


The other problem is that I do want to define an inverse for Employee.company, but I can't set it to *both* Company.currentEmployees and .previousEmployees. I think the answer is to maintain the Employee.company relationship field myself without any inverse, but then I get two more warnings for each of the Company to- many relationships.


This model was easy to implement in Foundation, I just created a bunch of Employee objects and just made sure they were in the proper sets (current/previous/interesting). I suppose I could model this by just having the "current"/"previous" and "interesting"/"not interesting" status be properties of the Employees themselves, but I'd prefer that A) Employees don't have access to these statuses and B) that my Company/Consultant can have tidy sets of relevant Employees. What's the best way for an object to be belong to multiple to-many relationships in Core Data?

thanks,
-natevw
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Core Data warning: to-many relation does not have an inverse
      • From: Quincey Morris <email@hidden>
  • Prev by Date: efficiency of Xquery vs NSXMLElement attributes
  • Next by Date: Re: Problem setting a Core Data Document Icon
  • Previous by thread: Re: efficiency of Xquery vs NSXMLElement attributes
  • Next by thread: Re: Core Data warning: to-many relation does not have an inverse
  • Index(es):
    • Date
    • Thread