Chaitanya,

What is the best way to re-insert a deleted object back in to the managed object context?

-insertObject: will reinsert a deleted object. -insertObject and - deleteObject will cancel each other out.

Typically, one wouldn't validateForInsert until after reinserting the object, and then fixing up the relationships. -validateForInsert is closer in meaning to "can I save (insert into db) this object yet ?" It's perfectly fine to be in an in between state, as long as you clean it up before saving.

One more thing, if i directly insert the object without checking it
for validation and then call [A isInserted] it returns NO if i do it
in the same loop, if i do it later, it returns YES, is there anything
special i need to do so that the isInserted flag would be updated?

If insertObject & deleteObject cancel each other out, then -isInsert will return NO, since the deletion was effectively canceled, and you won't be saving either the insert or delete to the database. Basically, you returned to a neutral state.

- 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 [EMAIL PROTECTED]

Reply via email to