• 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: Setting a Default toOne Relationship
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting a Default toOne Relationship


  • Subject: Re: Setting a Default toOne Relationship
  • From: Paul Lynch <email@hidden>
  • Date: Fri, 19 May 2006 09:48:51 +0100


On 18 May 2006, at 18:25, Ken Anderson wrote:

Besides calling the set method in awakeFromInsertion(), I can't imagine what else there is to do. Of course, you need to get the EO in the correct editing context. Since the EC is passed into the awakeFromInsertion() method, you could:

public void awakeFromInsertion(EOEditingContext ec) {
MyObject obj = EOUtilities.objectMatchingKeyandValue(ec, "ENTITY", "KEY", "VALUE");
setRelObj(obj);
}

One catch that I have found with this approach is that, if you create a local instance of the object in a different editing context, the related object is still in the old ec, assuming that you haven't first saved the record with the updated relationship and refaulted the objects. I don't see how this can be avoided, or even if you should attempt to avoid it.


Paul
_______________________________________________
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: 
 >Setting a Default toOne Relationship (From: David Avendasora <email@hidden>)
 >Re: Setting a Default toOne Relationship (From: Ken Anderson <email@hidden>)

  • Prev by Date: Re: Setting a Default toOne Relationship
  • Next by Date: Re: Setting a Default toOne Relationship
  • Previous by thread: Re: Setting a Default toOne Relationship
  • Next by thread: Re: Setting a Default toOne Relationship
  • Index(es):
    • Date
    • Thread