Re: What does core data do during a Save As?
Re: What does core data do during a Save As?
- Subject: Re: What does core data do during a Save As?
- From: Gideon King <email@hidden>
- Date: Sat, 2 Oct 2010 14:37:40 +1000
Following this discussion, I thought I would do a different test by making the back links transient and saying that they were not inverse links from the original ones, and making sure that they were manually set where required. But the validation errors still occurred, though now it is just the source complaining that the destination is not valid.
So I then took a destination of one of the relationships and took the transient back link totally out of Core Data and just made it an ordinary property, and it removed the error for that relationship (but of course I would rather have the relationships in core data).
The only other relationship that was giving the validation errors, which was not pointing to either the parent or child entity was another entity that had a relationship to an entity that had a relationship to the parent entity. In other words, the only validation errors I got on anything were in some way related to things that pointed back to either my parent or child entity.
There is also a relationship that I'm sure has been in place for some time between the child entity and another entity, and that one used to work (the other relationships are relatively new).
I therefore believe that I must have done something either in the parent entity, the child entity, or one of their managed object classes or cache node classes between when it used to work (for the old relationship) and now.
Seeing as all this is happening in Core Data's black box and it's not giving anything away as to why the object is not valid or what it is doing in the migration, and I have no tool to diff models, I will have to check out every update where the affected files changed and build and test until I can narrow it down, and then do a manual check of what changed in the model. My current theory is that something about the model has changed in such a way that the migration doesn't know how to migrate one of the entities properly, and that even though they look perfectly fine to me, there is something it is not happy about.
At least this has helped me narrow it down to half a dozen places to look instead of the whole model and persistency code.
I'll report back how I get on, in case someone else encounters similar problems, and in the meantime, if anyone who knows more about what may be causing the migration issues has any pointers, I'd love to hear...
Regards
Gideon
On 02/10/2010, at 3:44 AM, Quincey Morris wrote:
>
> Well, I'm not sure I understand all the factors in your scenario, but it's known that Core Data implements Save As as a migration process using a mapping model that it constructs on the fly, and that this fails for models that have parent entities -- specifically when the parent entities contain relationships. It sounds a bit like this is what's happening to you.
>
> The last time I tried doing this was under Leopard, and in the end I gave up trying to get Save As to work reliably. Whether the situation is improved in Snow Leopard, I don't know. Whether there's a general solution or workaround, I don't know.
>
> Here are some alternatives you might like to consider:
>
> 1. Take the "Save As" item off your "File" menu. (Seriously.)
>
> 2. Re-work your data model to not use parent entities. To get the kind of object graph you want, you may still need to use an auxiliary entity to represent the relationships, but just not a parent entity.
>
>
_______________________________________________
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