Jim,

Are you inspecting ctryID to see if it's set? If you are, that implies to me that cntryID is a class property, and it should not be. What *should* be set is the country relationship. The cntryID will not be set until EOF is preparing to save your data to the database. You can tell if something is a class property or not be whether or not the diamond is next to it in EOModeler. The country relationship should have a diamond, the cntryID attribute should not.

Ken

On Feb 2, 2006, at 11:11 PM, Art Isbell wrote:

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 protected])
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/webobjects-dev/lists% 40anderhome.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:
http://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to