Re: CoreData: "Can't reassign an object to a different store once it has been saved."?
Re: CoreData: "Can't reassign an object to a different store once it has been saved."?
- Subject: Re: CoreData: "Can't reassign an object to a different store once it has been saved."?
- From: Jim Correia <email@hidden>
- Date: Fri, 15 Jul 2005 10:14:41 -0400
On Jul 15, 2005, at 9:19 AM, Jim Correia wrote:
Any idea what I've done wrong, and how to correct it?
I thought I was manually assigning newly created objects to the
primaryStore, but I had a typo in one place, and didn't assign a
helper object that was created in awakeFromInsert. After fixing those
problems, I stopped getting the exception on save.
However...
The documentation says:
- (void)assignObject:(id)object toPersistentStore:(id)store
Specifies the store in which a newly inserted object will be saved.
You can obtain the store identifier from the persistent store
coordinator, using for example persistentStoreForURL:. It is only
necessary to use this method if the receiver’s persistent store
coordinator manages multiple writable stores that have the
specified object’s entity in their configuration, otherwise it is
unnecessary. Maintaining configurations in the managed object model
can eliminate the need for invoking this method directly in many
situations.
So it sounds like I can avoid all this manual assigning if I create a
configuration, and then add the inMemoryStore to the coordinator
using this configuration?
I've tried creating an InMemoryConfiguration for the Library entity,
and letting the on disk store use a nil configuration, and without
the manual assignObject:toPersistentStore:, it fails in the same way.
I also tried creating an explicit configuration for the xml store
which contained all the entities except the Library, and it fails in
the same way.
Does anyone have an example or simple explanation for how to set this
up so I don't have to do the manual assign every time I insert an
object?
Thanks,
Jim
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden