Hi Pablo,
Obviously you cannot model this in the database without a FK in the
person table.
However, bidirectional references are not required by OJB (Group can
have a collection of Persons without Person having a reference to
Group). The FK is required on Person, but you can either make it a
private attribute without getters and setters or use the anonymous keys
feature of OJB to only add the FK to the Person class descriptor.
<class-descriptor class="Person" table ="Person" >
...
<field-descriptor
name="groupID"
column="groupID"
jdbc-type="INTEGER"
access="anonymous"
/>
...
Hope this helps.
Wally
-----Original Message-----
From: Pablo A. Osso [mailto:[EMAIL PROTECTED]
Sent: Friday, November 28, 2003 9:32 AM
To: OJB Users List
Subject: Help with 1n mapping (new to OJB)
Hello,
Can anybody help me understand 1:n associations ? OJB site isn't clear
to me.
Here is my case:
I have a "Group" which has a "Person" collection named "members". How
can I resolve this without adding a foreing key to "Person" ? I don't
want "Person" to know in what group is a member. Warning: "Person" can
only be in one "Group".
Sorry if I'm not clear. Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]