Re: EditingContext problem
Re: EditingContext problem
- Subject: Re: EditingContext problem
- From: Jonathan Rochkind <email@hidden>
- Date: Tue, 20 Apr 2004 16:14:59 -0500
At 3:51 PM -0500 4/20/04, James Cicenia wrote:
I for instance, save the user after login into the session.. however,
the user comes from the defaultEditingContext. When I go to create/edit
my other object in a popup with a new EC, it doesn't like the user
which is in a different context.
How do I solve this conundrum?
You get a copy of the object in the proper editing context:
EOEditingContext ec; //the ec we want the object to be in
EOEnterpriseObject eo; //an EO that may not be in EC, but is
committed to the db
EOEnterpriseObject eoInRightEC = EOUtilities.localInstanceOfObject( ec, eo );
//eoInRightEC represents same row in the db as eo, but is in the EC
we want it to be in.
In general, it is important to _never_ set a relationship from an EO
in one EC to an EO in another EC. It will never work. This is the
biggest (pretty much the only) developer challenge to using multiple
ECs, keeping that straight.
--Jonathan
Thanks again,
James Cicenia
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
webobjects-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/webobjects-dev
Do not post admin requests to the list. They will be ignored.