• 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: Peer ECs in updating EO
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Peer ECs in updating EO


  • Subject: Re: Peer ECs in updating EO
  • From: amiel montecillo <email@hidden>
  • Date: Fri, 20 Feb 2009 22:39:54 +0800

Cool! Thanks guys.

Amiel

On Fri, Feb 20, 2009 at 7:13 PM, David LeBer <email@hidden> wrote:

On 20-Feb-09, at 4:15 AM, Cheong Hee (Datasonic) wrote:

Hi Amiel

Sorry for wrong title posted in previous email...

>> On 20/02/2009, at 4:47 PM, amiel montecillo wrote:
>>
> What I mean is, in PeerEC1, i made changes to the object, the changes are
> not seen in PeerEC2 thus calling PeerEC2.saveChanges() does not contain
> changes in the object right?
>
> I tried to do this in PeerEC2 (this is a bad hack):
>
> Post p = Post.localInstanceIn(PeerEC2, this.post);
> p.setSomething(this.post.something());
> PeerEC2.saveChanges(); <-- this actually reflects the changes to the DB.
>
>
> What could be a better route?
>

This URL will be useful to read about object graph management between
multiECs:

http://developer.apple.com/DOCUMENTATION/WebObjects/Reference/API5.2.3/com/webobjects/eocontrol/concepts/EOEditingContextConcepts.html#MANAGINGCHANGES

I wrote a blog post with an intro to working with multiple ECs: < http://davidleber.net/?p=322>

Two basic rules:
       1. You cannot relate EOs in different ECs
       2. You cannot move uncommitted EOs between ECs

And, in general I've always found it safer to do:

       myEO.editingContext().saveChanges();

Rather than:

       myEC.saveChanges();

That way you are guaranteed of getting the correct EC.

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:        http://www.linkedin.com/in/davidleber
twitter:        http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.org




_______________________________________________
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



--
socket error: unable to connect to 127.0.0.1
 _______________________________________________
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: 
 >Re: Peer ECs in updating EO (From: "Cheong Hee (Datasonic)" <email@hidden>)
 >Re: Peer ECs in updating EO (From: David LeBer <email@hidden>)

  • Prev by Date: Re: WORepetition and Cart Functionality
  • Next by Date: Re: where to put the css and JS
  • Previous by thread: Re: Peer ECs in updating EO
  • Next by thread: Re: Peer ECs in updating EO
  • Index(es):
    • Date
    • Thread