Re: Relationships howto
Re: Relationships howto
- Subject: Re: Relationships howto
- From: Art Isbell <email@hidden>
- Date: Thu, 2 Feb 2006 18:11:28 -1000
On Feb 2, 2006, at 4:36 PM, Jim Wong wrote:
too used to the normal DB lingo...yah...got to call them entities,
attributes and objects.
as i have mentioned, I have the 2 entities COMPANY and COUNTRY
already. I want a WOPopup in a web component (called newCompany) to
display all the ctryNames of COUNTRY. And when user selected the
country name, and click submit, the corresponding ctryID (from
COUNTRY) should be placed in the ctryID attribute of COMPANY.
There you go again using that old relational DB lingo :-) You want
to set company's country relationship to the country with the
selected country name.
I tried creating a To-One relationship between COUNTRY and COMPANY
and do the binding but seems not to work. so how do I do such
binding and relationship?
Assuming that you have a to-one Company.country relationship with an
optional to-many Country.companies relationship, possibly the easiest
approach to describe here would be to use a WOToOneRelationship
reusable component in the JavaWOExtensions framework (<http://
developer.apple.com/documentation/WebObjects/Reference/WOJExtensions/
WOToOneRelationship/chapter_33_section_1.html>). WOToOneRelationship
does the right thing with inverse relationships by invoking
addObjectToBothSidesOfRelationshipWithKey() unlike merely binding a
relationship key (e.g., company.country) to a WOPopUpButton's
"selection" key. You can certainly make a WOPopUpButton do the right
thing, but a few lines of coding is required.
Aloha,
Art
_______________________________________________
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