RE: Core data save error with multiple persistent stores
RE: Core data save error with multiple persistent stores
- Subject: RE: Core data save error with multiple persistent stores
- From: Arthur C. <email@hidden>
- Date: Mon, 17 Nov 2008 17:33:56 +0100
- Importance: Normal
>>It might also be worth putting a test in awakeFromInsert -- first
>>check if the object has been assigned to a persistent store, and only
>>assign if it has not.>Done that; it doesn't get called more than once, and it doesn't help to do >the assignObject: toPersistentStore: outside the awakeFromInsert.>
>Note that on systems with OS 10.5 (Leopard) it works fine, while on 10.4 (Tiger)>it always gives the error... >>We'll try to set it up using configurations in the data model. Any other suggestions?Okay, I've made a minimal test project using configurations in the data model, so we no longer need the assignObject: toPersistentStore: calls.The exception 'can't reassign object to a different store once it has been saved' occurs on quitting the application in the following case:- we have two managedObjectContexts, to be able to have separate save actions.- in one store we have two entities having a one-to-many relationship (say Person and Hobby).- in the second store we have just a single entity.- there are object instances of all entities present when we start the program.- we have added a new Person *and* we set the relationship of two Hobbys to one Person.- we are running on Tiger (10.4), not on 10.5 (this seems to matter).We are using standard interface for 'many objects'; array controllers bound to the correspondingmanaged object context.It turns out that the relationship is critical; with the relationship set to 'No Value' there is no error; when it is set in a newly added object, things go wrong. When running on Leopard, no problems...It seems that problems only come when there is one object having a relation to two or more other objects.So, the problem is now more accurately defined. I hope someone has an idea how to tackle this one, as it prevents us in a nasty way from having multiple separately savable stores.Thanks,Arthur C.
_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden