Search code examples
ioscore-datansmanagedobjectcontext

Core data: Does inserting an NSManagedObject manually into managedObjectContext insert its related NSManagedObjects too?


I have an Author entity. An Author entity, in its Class definition, has a set of Book entities as a 1:many relation.

Author is not inside a managedObjectContext at the moment.

When I say [self.managedObjectContext insert:author] will this automatically insert its child Book entities as well? (the author entity has book entities in existence already and they too are not in any managedObjectContext at the moment.)

Or must I also manually insert all related entities myself?


Solution

  • You must manually insert all related entities.