I set it in the awake, but did not clear it in the sleep.
public void awake() {
super.awake();
ERXThreadStorage.takeValueForKey(user(), "currentUser");
ERXThreadStorage.takeValueForKey(currentCategory(),
"currentProjectCategory");
}
what do I do in the sleep to clear it.
I don't believe this is the problem. In the logs of the init of the EO, I see
the correct ProjectCategory is arriving. The error actually arrives after the
NSLog has fired.
Jul 27 09:27:02 ASPOProjectManager[64526] INFO NSLog Page:
er.modern.look.pages.ERMODListPage - Configuration: ListSaleAdProjects -
initing the Project EO <com.as.model.ProjectCategory pk:"1">
Jul 27 09:27:02 ASPOProjectManager[64526] INFO NSLog Page:
er.modern.look.pages.ERMODListPage - Configuration: ListSaleAdProjects -
initing the Project EO this.projectCategory().categoryTitle() Sale Ads
Jul 27 09:27:02 ASPOProjectManager[64526] WARN NSLog (CreateProject) -
<com.webobjects.appserver._private.WOComponentRequestHandler>: Exception
occurred while handling request:
java.lang.IllegalStateException: Destination entity could not be retrieved from
EO of bindings. Either set the "sourceObject" to an EO, provide the
"sourceEntityName" and "relationshipKey", the "destinationEntityName" or the
"possibleChoices" binding.
[2012-7-27 9:27:2 EDT] <WorkerThread13> java.lang.IllegalStateException:
Destination entity could not be retrieved from EO of bindings. Either set the
"sourceObject" to an EO, provide the "sourceEntityName" and "relationshipKey",
the "destinationEntityName" or the "possibleChoices" binding.
--- On Fri, 7/27/12, David Holt <[email protected]> wrote:
> From: David Holt <[email protected]>
> Subject: Re: set the "sourceObject" to an EO ??
> To: "Theodore Petrosky" <[email protected]>
> Cc: "[email protected]" <[email protected]>
> Date: Friday, July 27, 2012, 9:39 AM
> Did you set and clear
> ERXThreadStorage in the session's awake and sleep methods?
>
> Sent from my iPad
>
> On 2012-07-27, at 6:31 AM, Theodore Petrosky <[email protected]>
> wrote:
>
> > I am trying to use ERXThreadStorage to copy an EO
> relationship into a newly created EO.
> >
> > in my MainNavigatorController I have a method:
> >
> >
> > public WOComponent listSaleAdsProjectsAction() {
> >
> > NSLog.out.appendln("***
> listSaleAdsProjectsAction *****" );
> > ERXEC ec = (ERXEC)
> (session().user().editingContext());
> > ProjectCategory theCat =
> ProjectCategory.fetchProjectCategory(ec,
> ProjectCategory.CATEGORY_TITLE.eq("Sale Ads"));
> >
> > ((Session)
> session()).setCurrentCategory(theCat);
> >
> > ListPageInterface lpi =
> (ListPageInterface)
> D2W.factory().pageForConfigurationNamed("ListSaleAdProjects",
> session());
> > EODataSource ds = new
> EODatabaseDataSource(ec, "Project");
> >
> >
> >
> > // limit the blog entries returned to the
> logged in user
> > ds.qualifyWithRelationshipKey("projects",
> theCat);
> >
> > lpi.setDataSource(ds);
> >
> > return (D2WPage) lpi;
> > }
> >
> > so the current category in set in the session:
> >
> >
> > public void setCurrentCategory(ProjectCategory theCat)
> {
> > this._currentProjectCategory = theCat;
> > NSLog.out.appendln("***setCurrentCategory:
> " + theCat);
> >
> > ERXThreadStorage.takeValueForKey(theCat,
> "currentProjectCategory");
> >
> > NSLog.out.appendln("***after
> setCurrentCategory: " +
> ERXThreadStorage.valueForKey("currentProjectCategory"));
> >
> > }
> >
> > in my init method of my Project object:
> >
> > public void init(EOEditingContext ec) {
> > super.init(ec);
> > NSLog.out.appendln(" initing the
> Project EO " );
> > NSLog.out.appendln(" initing the
> Project EO " +
> ERXThreadStorage.valueForKey("currentProjectCategory"));
> >
> > ProjectCategory currentaCat =
> ((ProjectCategory)
> ERXThreadStorage.valueForKey("currentProjectCategory")).localInstanceIn(ec);
> >
> setProjectCategoryRelationship(currentaCat);
> >
> > NSLog.out.appendln("
> initing the Project EO
> this.projectCategory().categoryTitle() " +
> this.projectCategory().categoryTitle());
> >
> > }
> >
> > I know that the ERXThreadStorage valueForKey is
> correct, however I get the error:
> >
> > Destination entity could not be retrieved from EO of
> bindings. Either set the "sourceObject" to an EO, provide
> the "sourceEntityName" and "relationshipKey", the
> "destinationEntityName" or the "possibleChoices" binding.
> >
> > Help please!!
> > I don't understand what bindings I need to make, or
> rather I don't understand how to make these bindings.
> >
> > Ted
> >
> >
> > _______________________________________________
> > 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/programmingosx%40mac.com
> >
> > This email sent to [email protected]
>
_______________________________________________
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]