Kirk
I think what you described is actually what Lewis was trying to achieve.
The problem is that Rose did not generate the tables Lewis was expecting.
Instead of getting:
Table Address
Address_ID:int (PK)
Country_ID:int (FK)
Table Country
Country_ID:int (PK)
He got:
Table Address
Address_ID:int
Table Country
Country_ID:int
Address_ID:int (FK)
BTW I can't imagine a domain where a postal Address can have more than one
Country. But if one exists I would love to hear about it.
James Shields
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
<http://www.pchome.com.tw/>
PC home Online ÷?¸?®a®x¡@¡@ ·|?²??@¡A¥x?W³??j×÷?J?f÷?¯¸
==========================================================
************************************************************************
* Rose Forum is a public venue for ideas and discussions.
* For technical support, visit http://www.rational.com/support
<http://www.rational.com/support>
*
* Admin.Subscription Requests: [EMAIL PROTECTED]
* Archive of messages:
http://www.rational.com/products/rose/usergroups/rose_forum.jtmpl
<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
*
*************************************************************************
************************************************************************
* 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
*
*************************************************************************