Hi Wally, thanks for your answer first of all. I already was afraid to hear that. Why does this limitation exist? I don't see the point for this unbreakable, implicit commitment. It might be right that in many cases a need of this points out a lack in the database design, but not necessarily.
As I understood there is no way to have several primary keys (not compound), right? Is there a way to get around this using a query-customizer? Is there a way/chance to introduce another element inside the collection descriptor to declare the referenced field explicitly? One more answer to my questions would help me a lot. Thanks, Norbert. -----Original Message----- From: Gelhar, Wallace Joseph [mailto:[EMAIL PROTECTED] Sent: Dienstag, 02. Dezember 2003 15:31 To: OJB Users List Subject: RE: 1:n Mapping 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
