persistence@glassfish.java.net

question about object relationships

From: jeff <jeffrey.blattman_at_yahoo.com>
Date: Wed, 14 Mar 2007 12:25:49 -0700 (PDT)

in a one to many (or 1-1) relationship, i want the many's ID to incorporate it's one's ID.

for example, if a have a Computer that has Ports. each port has a type, say "USB", "serial", etc. furthermore, say i can only have one of each type of port in a particular Computer.

many Computers can have a Ports of the same type. how do i represent this? what is the ID for Port? the type is enough to ID it within the Computer, but i don't know how to represent this in JP. i think i want the Port's ID to incorporate the Computer's ID.

in the database, i think this would mean that the table for Port has a foreign key pointing back to the the ID column of the table for Computer.

i hope this makes sense.
thanks!



 
---------------------------------
Now that's room service! Choose from over 150,000 hotels
in 45,000 destinations on Yahoo! Travel to find your fit.