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

Re: Nested EOEditingContext Question


  • Subject: Re: Nested EOEditingContext Question
  • From: Johann Werner <email@hidden>
  • Date: Sun, 6 Sep 2009 11:22:00 +0200


Am 06.09.2009 um 10:29 schrieb Chan Yeow Heong, Jerome:

So what happens after I do

nested.save();

This commits all changes of nested to original.

original.save();

This commits all changes of original to the data storage (mostly this will be the database).



Does nested go away? Does it get garbage collected?

If you don't hold any references to nested anymore then yes it will be garbage collected.


What is the editing context of the objects manipulated after both saves are done? Is it original?

You mean if there were additional changes in original (made outside of nested) are they reflected in nested? Looking at http://developer.apple.com/legacy/mac/library/documentation/LegacyTechnologies/WebObjects/WebObjects_4.5/System/Documentation/Developer/WebObjects/Topics/ProgrammingTopics.39.html a nested editing context behaves as any other 'normal' one. A standard editing context doesn't see changes in the database unless it refetches its objects. So I would guess that the nested editing context doesn't see the changes that were made outside of it in the parent unless you 'refetch' them into it. But this is just a guess, I use nested editing contexts very rarely in special cases. A safe method would be to throw your old nested editing context away and create a new one after the save. As it doesn't have to make a roundtrip to the database which would cost time, it gets its objects from another editing context in memory which won't cause a noticeable delay.




On 05-Sep-2009, at 6:47 PM, Johann Werner wrote:

Hi Jerome,

Am 05.09.2009 um 11:50 schrieb Chan Yeow Heong, Jerome:

When I'm using nested editing contexts, do I need to call revert on a original editing context when I call revert on the nested context?


EOEditingContext original = ERXEC.newEditingContext(true); EOEditingContext nested = ERXEC.newEditingContext(original,true);

... do some work ...


... something went wrong and we have to cancel all changes ...

nested.revert();
original.revert(); // <-- Is this second call needed?

No, this call is not needed. A nested editing context behaves as any other 'normal' editing context with the only difference that saving the context doesn't push your changes to the db but into the parent context. So either call revert on your nested context or just discard the context and replace it by a new one.


jw

_______________________________________________ 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



_______________________________________________
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


  • Follow-Ups:
    • Re: Nested EOEditingContext Question
      • From: Houdah - ML Pierre Bernard <email@hidden>
References: 
 >Nested EOEditingContext Question (From: "Chan Yeow Heong, Jerome" <email@hidden>)
 >Re: Nested EOEditingContext Question (From: Johann Werner <email@hidden>)
 >Re: Nested EOEditingContext Question (From: "Chan Yeow Heong, Jerome" <email@hidden>)

  • Prev by Date: Re: Nested EOEditingContext Question
  • Next by Date: Re: Nested EOEditingContext Question
  • Previous by thread: Re: Nested EOEditingContext Question
  • Next by thread: Re: Nested EOEditingContext Question
  • Index(es):
    • Date
    • Thread