Hi,

Aleks wrote:
Hi,
I'm new to OJB and have been looking at the tutorials and examples and
so far all looks good apart from an example I found that works well but
I am not sure how it would work in the case of composite keys.  The
example is the 1:N example between Product and Article tables.
(http://db.apache.org/ojb/docu/guides/basic-technique.html )
...
As can be seen there, productGroupId is the foreign key used in the
Article table (I haven't actually posted the Article mapping). This
works fine since, as you can see, the Product table has one primary key,
namely 'groupId'. What I was wondering is how would I perform this
example if the Product table had a composite primary key consisting of
let's say:
* int groupId
*         int groupNum and
*         int groupKey
The problem is that they're all of the same type so how can it be known
which parts of the foreign key in Article are "pointing" to which parts
of the primary key in Product?

AFAIK it's the order of declaration. If the PK field-descriptor declaration in ProductGroup is
int groupId
int groupNum and
int groupKey

then in Article the FK declaration have to use the same order.

regards,
Armin

Thank you for your help.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to