• 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: Creating related objects and multiple ECs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating related objects and multiple ECs


  • Subject: Re: Creating related objects and multiple ECs
  • From: David Avendasora <email@hidden>
  • Date: Wed, 17 Feb 2010 06:17:53 -0500

On Feb 16, 2010, at 5:31 PM, David LeBer wrote:

> It definitely doesn't work trying to pull an EO in a child ec into it's parent's. i.e:
>
>    	EOEditingContext rootEc = ERXEC.newEditingContext();
>    	EOEditingContext childEc = ERXEC.newEditingContext(rootEc);
>    	Movie m = Movie.createMovie(rootEc, "Test", null);
>    	Studio s = Studio.createStudio(childEc, new BigDecimal(100.00), "Test");
>    	Studio localS = s.localInstanceIn(m.editingContext());
>
> BOOM: "You attempted to localInstance <org.wocommunity.movies.model.server.Studio pk:"null">, which has not yet committed."
>
> I thought I'd gotten a similar message when I tried the other way around, but I probably got distracted and... OOH! SHINY!...

As helpful as Anjo's comment was, I'm going to try to add to it (crazy, I know).

In this example, why not just call childEc.saveChanges() after creating the Studio? That won't actually save it to the DB/ObjectStore, just to the rootEc. Then you can easily just do m.setStudio(s), and I don't think you even need to do the localInstance, do you? (It's been a while since I did nested ECs)

Dave _______________________________________________
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: Creating related objects and multiple ECs
      • From: David LeBer <email@hidden>
    • Re: Creating related objects and multiple ECs
      • From: Mike Schrag <email@hidden>
References: 
 >Creating related objects and multiple ECs (From: David LeBer <email@hidden>)
 >Re: Creating related objects and multiple ECs (From: Chuck Hill <email@hidden>)
 >Re: Creating related objects and multiple ECs (From: David LeBer <email@hidden>)
 >Re: Creating related objects and multiple ECs (From: Chuck Hill <email@hidden>)
 >Re: Creating related objects and multiple ECs (From: David LeBer <email@hidden>)

  • Prev by Date: Re: session timeout trouble
  • Next by Date: Re: [MEET] WO-NoVA NEXT TUESDAY 2/16
  • Previous by thread: Re: Creating related objects and multiple ECs
  • Next by thread: Re: Creating related objects and multiple ECs
  • Index(es):
    • Date
    • Thread