Problem with one-way Core Data relationship not persisting
Problem with one-way Core Data relationship not persisting
- Subject: Problem with one-way Core Data relationship not persisting
- From: Greg Reichow <email@hidden>
- Date: Sun, 21 Feb 2010 19:20:22 +0800
I have a problem with the core data object graph not properly persisting:
Managed Object A (Car) has a one-way, one-to-many relationship to several Managed Object B's. (Tires)
When I create the object graph, I use the standard generated relationship set mutator methods to setup the relationships:
[carMO addTireObject:tireMO]
After creating the full object graph, I have validated that everything is correct. Reviewing the relationship sets show 4 tires in the set of the car relationship.
Yet, when I save this to the persistent store and either reset the MOC or rerun the app and access the previously saved data, everything is there but many of the relationships noted above are missing. *If I switch the type to a 2-way inverse relationship (many-to-many), it all works fine * Without going into too much detail, establishing this with the inverse is causing a dramatic and not acceptable increase in the time to save and also the size of the store. (1M+ cars, 50 tires each for example).
My question is not around the performance issue with the inverse. I would like to understand why the one-way relationship is not sticking. I don't need the inverse and the cost is too high. I have tried making sure that all the tires are flushed to the persistent store and have permanent ID's first; no change in the above. Also, as I mentioned, it is not 100% of the relationships that are missing. I can not find a pattern and roughly 90% are not sticking.
Any insight into using a one-way one-to-many relationship?
Thanks,
Greg
_______________________________________________
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