• 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: InsertObject
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: InsertObject


  • Subject: Re: InsertObject
  • From: Ken Anderson <email@hidden>
  • Date: Wed, 30 May 2007 06:09:29 -0400

Frederic,

I'm not sure what you mean by over-complicated. Whenever you create an EO, you need to insert it into the editing context - you should do this immediately when the object is created.

You can then perform a save changes at any time, and it will serialize all outstanding changes to the database.

It's easiest to think of saveChanges() as more like a committing a set of changes, rather than 'saving' an object. You could make thousands of changes to your EOs, then at the end, when the object graph is complete, just call saveChanges() on the editing context. There is no reason to call saveChanges() multiple times... in fact, if you do, you could end up with a database that is out of sync. If you make all your object graph changes, then save at the end, you'll either save everything to to the database, or nothing.

Ken

On May 30, 2007, at 4:59 AM, Frederic JECKER wrote:

Moin list,

Could someone answer the following question? :

I have two objects A and B, each extending EOGenericRecord.
Object A has a field of type B.
Now, when I create a new Object A which embeds a new object B, before performing an EditingContext.saveChanges
I must insert each object separately in my editingContext:
myContext.insertObject(B);
myContext.insertObject(A);
myContext.saveChanges();
.... which is rapidly over-complicated when saving complex object- graphs


Now, in order to perform the saveChanges in a more elegant way, can someone tell me if
there is a method to override, method called by EditingContext.saveChanges, in which I could
in each EOGenericRecord do the insertObject work ?


Thanks

Fj


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40anderhome.com


This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Webobjects-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >InsertObject (From: Frederic JECKER <email@hidden>)

  • Prev by Date: Re: InsertObject
  • Next by Date: Re: InsertObject
  • Previous by thread: Re: InsertObject
  • Next by thread: Re: InsertObject
  • Index(es):
    • Date
    • Thread