IMHO, I think a more appropriate table design would be an Address table with a Country column on it (a Character field). Then, possibly a Country table with a country_id column and a country_desc column. The country_id would be stored in the Address table. Subsequently, the Country is simply a lookup table (or code table, whatever you wish to call it).
An address is only going to have a single country. The country should not need to know what address it belongs to. If you have a country record for every address record, what good does it do to make them separate tables? A separate country class, on the other hand, may make sense because that attribute can have meaninful behavior.
Of course, I don't understand your domain either...
Kirk Knoernschild
Senior Consultant
TeamSoft, Inc.
www.teamsoftinc.com
www.kirkk.com
Consulting, Training, & Mentoring
**------------------------------------------------------------------------------------------
* The opinions expressed are mine, and do not necessarily
* represent those of my employer.
**------------------------------------------------------------------------------------------
-----Original Message-----
From: Lewis Lin [SMTP:[EMAIL PROTECTED]]
Sent: Tuesday, March 20, 2001 5:51 PM
To: Rose Forum (E-mail)
Subject: (ROSE) Many to one relationship
Hi,
I have an Address class that contain a Country class in Object Model.
class Address {
private Country country;
}
When I transfer this relationship to a data model. I got a wrong Table
design.
Table Address
Address_ID:int
Table Country
Country_ID:int
Address_ID:int (FK)
shouldn't the FK exist in Address? Since I set the relationship between
address and country in object model to many-to-one relationship?
Thanks,
Lewis Lin
Fairway Financial Consulting
==========================================================
PC home �K�O�q₪l�H�c�A�׃�׀�׀�: http://www.pchome.com.tw
PC home Online �פ�פ�a�x�@�@ �|
==========================================================
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages: http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
* Other Requests: [EMAIL PROTECTED]
*
* To unsubscribe from the list, please send email
*
* To: [EMAIL PROTECTED]
* Subject:<BLANK>
* Body: unsubscribe rose_forum
*
*************************************************************************
