persistence@glassfish.java.net

Re: question about object relationships

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Wed, 14 Mar 2007 14:28:47 -0800

It should work either way.

-marina

jeff wrote On 03/14/07 14:14,:
> thanks marina, i did see that.
>
> then i think my question becomes: is it necessary to have a
> bidirectional relationship to affect this behavior?
>
> thanks.
>
> */Marina Vatkina <Marina.Vatkina_at_Sun.COM>/* wrote:
>
> Look at the orderapp in the JavaEE tutorial - it has orders and
> lineitems with
> overlapping PK/FK mapping. This is most probably what you need.
>
> regards,
> -marina
>
> jeff wrote On 03/14/07 11:25,:
> > 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.
>
>
> ------------------------------------------------------------------------
> Need Mail bonding?
> Go to the Yahoo! Mail Q&A
> <http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091>
> for great tips from Yahoo! Answers
> <http://answers.yahoo.com/dir/index;_ylc=X3oDMTFvbGNhMGE3BF9TAzM5NjU0NTEwOARfcwMzOTY1NDUxMDMEc2VjA21haWxfdGFnbGluZQRzbGsDbWFpbF90YWcx?link=ask&sid=396546091>
> users.