small medium large xlarge

Back to: All Forums  Core Data
Generic-user-small
17 May 2010, 17:52
Eric Cooper (3 posts)

I have a released iPhone app that I am now updating. The original data model included an entity called “Experiment” which had to to-many relationship with “Run”. In the new data model these entities will still exist but their roles will be redefined (somewhat) and “Run” will have a to-many relationship with a new entity called “Sample”.

My questions revolve around the fact that some of Sample’s attributes will come from its associated Run (from source) and some will come from that Run’s Experiment (from source).

First question, in a mapping model can the same entity be the destination for more than one mapping?

Second question, within -createDestinationInstancesForSourceInstance:, can -executeFetchRequest: be called on [manager destinationContext]?

Thanks.

Avatarsmall_pragsmall
18 May 2010, 15:28
Marcus S. Zarra (284 posts)

For your first question; the same entity can be the destination for more than one mapping but that can get a bit tricky. You may be better off creating a custom mapping for each of the “source” entities and then retrieve the “destination” entities on each successive entity that needs to access the destination and manipulate it. Doing this inside of the mapping model editor would probably be more pain than it is worth.

As for calling @-executeFetchRequest: error:@, yes you can call that in the middle of a migration to access the destination entity.

Generic-user-small
25 May 2010, 18:16
Eric Cooper (3 posts)

Thanks for the answers. I am working on finalizing destination object model before resuming work on migration.

You must be logged in to comment