Using the example from the guides, when I create a new employee with

Employee *newEmployee = [NSEntityDescription
insertNewObjectForEntityForName:*@"employee"* inManagedObjectContext:*
context];*


I not only get a new employee, but also a new unnamed department. When I add the employee to the correct department, the new unnamed department remains
as a bonus. I've done this in steps (not using the convenience class
method), and see that the unwanted department is created in the
-initWithENtity:insertIntoManagedObjectContext method.

Core Data doesn't insert new objects by itself. You've probably added custom code in -awakeFrom* or overridden -initWithEntity:.. to create the department.

Alternatively, Cocoa Bindings will insert new objects if you go through the Add action to a controller bound to the Department entity.

- Ben

_______________________________________________

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

Reply via email to