• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [COREDATA] Assign NSManagedObject to persistent store
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [COREDATA] Assign NSManagedObject to persistent store


  • Subject: Re: [COREDATA] Assign NSManagedObject to persistent store
  • From: Guillaume Rager <email@hidden>
  • Date: Wed, 14 Dec 2005 08:18:43 +0100


Le 13 déc. 05 à 17:37, Bill Bumgarner a écrit :

On Dec 13, 2005, at 6:50 AM, Guillaume Rager wrote:
I have one managedObjectContext and two persistent stores (sqlstore and inMemoryStore) linked to this context.

Each time I create a managed object, it is assigned to the sqlstore or to the inMemoryStore. But sometimes I would like to finally put an object from inMemoryStore to sqlStore, but "coredata" does not seem to be ok, because context has been already saved.

So, do you have any solution to move a given object into another store ?

Once an object is saved into a store, that instance of that managed object will always live in that store. There is no notion of moving an object from one store to another.

At first glance, this may seem like an oversight on the part of the Core Data implementation. The problem is actually considerably more difficult. Core Data is all about managing a complex object graph; managing a set of objects that have relationships between each other.

If you were to move one object, what does that imply for the rest of the object graph? Without cross store relationships (which are really hard in generic terms), it would imply that the object and everything it is connected to would also have to move from one store to the other.

Out of curiosity, why do you have the two stores in the first place?

Well some objects are created from a "source", but we dont usually need to save them, so they are in inMemoryStore. But sometimes, these objects are detached from the source (some attributes are changed), so we need to keep in database these changes, this is why we need to move modified objects to sqlStore.

So I guess that I have to create a "copy" of the modified object and put into the sqlStore and remove the old one from the inMemoryStore...



b.bum



Guillaume

-----------
GUMITECH - France
http://www.gumitech.com

"Chaud cocoa, chaud chocolat !"

_______________________________________________
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
References: 
 >[COREDATA] Assign NSManagedObject to persistent store (From: Guillaume Rager <email@hidden>)
 >Re: [COREDATA] Assign NSManagedObject to persistent store (From: Bill Bumgarner <email@hidden>)

  • Prev by Date: Re: Getting the arguments of methods in other frameworks (from GDB)
  • Next by Date: -dataWithContentsOfFile returning a NSData object, but no file exists?
  • Previous by thread: Re: [COREDATA] Assign NSManagedObject to persistent store
  • Next by thread: "Controller cannot be nil" message when loading from file
  • Index(es):
    • Date
    • Thread