Hi Norbert, I assume that the attribute you want to treat as a primary key is a candidate key. Therefore, you can declare it as a primary key in the repository even if it is not a PK in the database. OJB always resolves FK for a collection descriptor against the declared primary key.
Hope this helps, Wally -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, December 02, 2003 7:02 AM To: [EMAIL PROTECTED] Subject: 1:n Mapping Hello, we need a 1:n mapping where the joining attribute of the parent class is not its primary key. Example: <class-descriptor class="at.gv.bmi.ClassA" table="TableA" > <field-descriptor name="fieldA" column="A" jdbc-type="CHAR" primarykey="true" /> <field-descriptor name="fieldB" column="B" jdbc-type="CHAR" /> <collection-descriptor name="joinAB" element-class-ref="at.gv.bmi.ClassB" > <inverse-foreignkey field-ref="fieldY"/> </collection-descriptor> </class-descriptor> <class-descriptor class="at.gv.bmi.ClassB" table="TableB" > <field-descriptor name="fieldX" column="X" jdbc-type="CHAR" primarykey="true" /> <field-descriptor name="fieldY" column="Y" jdbc-type="CHAR" /> <field-descriptor name="fieldZ" column="Z" jdbc-type="CHAR" /> </class-descriptor> The join has to be made from ClassA:B to ClassB:Y, ie the where condition has to be where A0.B = A1.Y instead of A0.A = A1.Y (does ojb uses A0.A because its the pk?). What do we have to do to get this join? Thanks for help, Norbert. --------------------------------------------------------------------- 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]
