CD: Splitting persistent stores between document and constant entities
CD: Splitting persistent stores between document and constant entities
- Subject: CD: Splitting persistent stores between document and constant entities
- From: Fritz Anderson <email@hidden>
- Date: Thu, 30 Mar 2006 23:51:40 -0600
SUMMARY: I want to split my model between a store for document data,
and a read-only store for common, constant data. Core Data doesn't
seem to want to do this.
Here is what I hope to do: The principal entity in my data model has
a property drawn from a list of legal values. I'd like embody those
values in an entity that has one instance per legal value. The
principal entity can make the relevant setting by referencing the
desired instance of the table entity.
I have a command-line tool that initializes the constant table and
puts it out to an XML data store. I put the XML file into the
Resources directory of my main application (Core Data document-
based). At initialization of MyDocument, I add the constants store to
the persistent-store coordinator for the document.
This arrangement shows no problems when viewing or editing the document.
But when I try to save the document, the document puts up a sheet
saying the save could not go through, because "The model
configuration used to open the store is incompatible with the one
that was used to create the store."
At first, I had tried writing and opening the constants file with a
configuration that restricted the model to the table entity, but I
gave up on that. No effect on the error message.
The application opens the constants store read-only. I figured this
would protect the constancy of the table. I never mutate the table
members, nor do any relationships originate from the table entity.
A try without the read-only option throws an exception: "Can't
reassign an object to a different store once it has been saved." This
suggests that the PSC is trying to migrate objects out of the
constants store, which I imagine should not be needed because the
references to the table-of-constants items are object IDs -- right?
I am confused. Googling the error message produces nothing. What
should I try next?
-- F
--
Fritz Anderson -- http://www.manoverboard.org/
Consulting Programmer -- http://resume.manoverboard.org/
Step into Xcode, Now Available -- http://six.manoverboard.org/
_______________________________________________
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