On Fri, Jun 6, 2014 at 9:43 AM, Theodore Petrosky <[email protected]> wrote:

>
> so it seems to me that the answer is to use  awakeFromInsertion, but do
> the check to be sure that the global id is NOT temporary or rather, in my
> case put my relationship creation code in a block that first checks if the
> global id is temporary as I only want this to run when I create a new EO.
>
>
>  @Override
>   public void awakeFromInsertion(EOEditingContext ec) {
>       super.awakeFromInsertion(ec);
>       EOGlobalID gid = ec.globalIDForObject(this);
>
>
>       if(gid.isTemporary()) {
>
>
>         for (Person aPerson: Person.fetchPersons(ec, Person.IS_PRIMARY.eq(
> true).and(Person.CURRENT.eq(true)), null)) {
>           ShowPerson.createShowPerson(ec, aPerson, this);
>         }
>       }
>
>
>   }
>
>
Which is exactly what Wonder's awakeFromInsertion does for you so you can
just put your code in init.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to