(Cc'd cocoa mailing list because this turns out to be relevant to those working with core data.)
This turns out to be much more sinister than I'd thought. The mapping model seems to be a red herring and the problem of having nil'ed out inherited attributes is not to do with the mapping model. To determine this I switched to "lightweight migration" and I got the same result: many of the inherited attributes where set to nil after migration of a document. So I inspected more closely the changes to the model. Here they are: 1) Added a new entity "Bookmarks" with a single attribute 2) Added a relationship "file" with destination "File" 3) In File, added a relationship "bookmarks" which is to-many and has destination "Bookmark" and inverse "file" These changes break the lightweight migration process (in that all inherited attributes are nil after migration of a document). If I set the inverse of the "bookmarks" relationship to "no inverse", then the migration works fine. The problem turns out to be the fact that I named the relationship "file" which is (nearly) the same as an entity "File". As soon as I changed the relationship name to "parentFile", then the migration process works with the inverse in place. Is there a know problem or limitation in naming relationships? I haven't come across this anywhere before. Martin On Aug 6, 2011, at 09:30 PM, Martin Hewitson wrote: > Furthermore, I can't delete the new model version I made (as was pointed out > in a different thread a few days ago). If I select a model version in the > project tree then look in the file menu, one entry is "Close 'Untitled'". If > I select the next model version, the menu item says "Close 'Untitled 2'". > Both model versions have correct names (not Untitled*) in the project tree > and on disk. What's going on, I wonder? > > Martin > > > On Aug 6, 2011, at 09:22 PM, Martin Hewitson wrote: > >> Dear list, >> >> Perhaps I'm doing something wrong, but it seems that when creating a core >> data mapping model, the attributes of the superclass are not included in the >> mapping of the subclass. >> >> Suppose I have EntityA with attribute Name and I have EntityB which is a >> subclass of EntityA. When I create a mapping model in Xcode 4 the mapping >> for Name is not included in the EntityBtoEntityB mapping. The result is that >> migrated core data models end up broken because the superclass attributes >> are not present in the updated model objects. I checked back to some old >> mapping models created in Xcode 3. There the subclasses do get mapping rules >> for the superclass attributes. I'm 99.9% certain I didn't add those myself, >> but rather they were created when creating the mapping model. I tried to add >> the necessary attributes to the mapping model in Xcode 4, but it isn't >> possible to add a rule based on the super class attributes, as far as I can >> see. This leaves me stuck. I can't create a working mapping model. >> >> Another thing I noticed. In an Xcode 3 mapping model (when loaded in Xcode >> 4) the entity mapping for existing entities have a type 'Copy'. In the >> mapping model created in Xcode 4, the type in now 'Transform'. I don't see >> any way to change this. Is it relevant? >> >> Any clues gratefully received. >> >> Martin >> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> Martin Hewitson >> Albert-Einstein-Institut >> Max-Planck-Institut fuer >> Gravitationsphysik und Universitaet Hannover >> Callinstr. 38, 30167 Hannover, Germany >> Tel: +49-511-762-17121, Fax: +49-511-762-5861 >> E-Mail: martin.hewit...@aei.mpg.de >> WWW: http://www.aei.mpg.de/~hewitson >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> >> >> >> >> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Martin Hewitson > Albert-Einstein-Institut > Max-Planck-Institut fuer > Gravitationsphysik und Universitaet Hannover > Callinstr. 38, 30167 Hannover, Germany > Tel: +49-511-762-17121, Fax: +49-511-762-5861 > E-Mail: martin.hewit...@aei.mpg.de > WWW: http://www.aei.mpg.de/~hewitson > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Martin Hewitson Albert-Einstein-Institut Max-Planck-Institut fuer Gravitationsphysik und Universitaet Hannover Callinstr. 38, 30167 Hannover, Germany Tel: +49-511-762-17121, Fax: +49-511-762-5861 E-Mail: martin.hewit...@aei.mpg.de WWW: http://www.aei.mpg.de/~hewitson ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com