Re: Migration with abstract entities
Re: Migration with abstract entities
- Subject: Re: Migration with abstract entities
- From: Quincey Morris <email@hidden>
- Date: Fri, 16 Jan 2009 15:53:27 -0800
On Jan 16, 2009, at 02:51, Samuel Strupp wrote:
does anybody know, how to migrate an object model with abstract
entities correctly?
The compiler throws errors for the mapping model "can't auto
generate value expression with nil mapping name".
I found no documentation about migration with abstract entities in
core data under Mac OS X 10.5!
I believe it's been stated on this list that this is not supported, at
least not automatically.
However, I did get it working, though I don't remember the details
exactly. IIRC, if you examine the auto-generated mapping model you'll
see that the concrete entities are missing the property mappings for
their properties inherited from abstract entities. If you just want to
preserve those properties, you can just create your own property
mappings for the concrete properties. The abstract entities might
contain the mappings you want to copy (there but not used), or just
look at a similar mapping elsewhere in the model, and use it as a
template.
Also IIRC, you don't need both directions of a relationship that has
an inverse. Setting either direction will change both directions, in
the usual Core Data manner.
The bad news is that abstract entities will cause
NSPersistentDocument's Save As to break, since it apparently uses a
Core Data migration to implement Save As, with an auto-generated
mapping model, which of course fails to copy the inherited
relationships properly. (My solution was to stop using abstract
entities in the next version of the data model. :) )
_______________________________________________
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