Re: Difference in relationships storage between various storage options (CoreData)
Re: Difference in relationships storage between various storage options (CoreData)
- Subject: Re: Difference in relationships storage between various storage options (CoreData)
- From: Alexander Lamb <email@hidden>
- Date: Thu, 15 Jun 2006 07:31:51 +0200
It is marked with it's inverse in the model. But doing a
"setDepartment" doensn't automagically set the inverse, or does it?
At the time of WebObjects it was necessary to do a
"addObjectToBothSidesOfRelationshipWithKey". Is it the same with
CoreData?
Alex
--
Alexander Lamb
email@hidden
On Jun 14, 2006, at 6:20 PM, Chris Hanson wrote:
On Jun 13, 2006, at 11:49 PM, Alexander Lamb wrote:
Well, I made a mistake in my code somewhere. I set the
"employee.department" correctly, but forgot to do an "addObject"
to "employee.departements".
The result was not only my object graph was wrong in memory, but
it was also wrong in the file! Even restarting the application
(reloading data), I had an employee belonging to a department but
a department without that same employee.
I assume the second relationship above should be
"department.employees".
You should mark the two relationships above as inverses in your
data model. This will allow you to manipulate one side of the
relationship for an object with Core Data maintaining the other
side of it for you automatically.
-- Chris
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden