Also if you have an entity named "Project" and another named "ProjectCategory" you may need to distinguish them for D2W with different priority rules.
http://davidleber.net/?p=273 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]
