Hi, I don't really understand you're pb. ;o( Is it : any field from my class A can be THE foreign key (mykey in this case) from my class B ?
Regards �ric -----Message d'origine----- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoy� : jeudi 27 novembre 2003 17:49 � : [EMAIL PROTECTED] Objet : RE: Mapping question Thanks, I defined it like that, but: >If A is 1 and B is n. >In A class descriptor write : ><collection-descriptor name="relation_name_in_A_class" >element-class-ref="url.B"> > <inverse-foreignkey field-ref="mykey"/> ></collection-descriptor> >And in B class descriptor write this ><field-descriptor name="mykey" column="mycolumn" jdbc-type="INTEGER"/> >Here mykey is the foreignkey but not a primary key ! OJB generates statements where mykey points to the pk of class A. The generated join looks like: A.pk = B.mykey We need: A.anyField = B.mykey In fact I think we've a m:n mapping without intermediary table... What can we do (the database model cannot be changed)? Is there a possibility to add to the collection-descriptor something like <foreignkey field-ref="anyField"/> similar to the <inverse-foreignkey/> element? Thanks again. -----Message d'origine----- De : [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Envoy� : jeudi 27 novembre 2003 16:57 � : [EMAIL PROTECTED] Objet : Mapping question Hi, I've got a 1:n mapping from table A to table B. But the foreign key field of table A is not it's primary key. I can't find how to tell OJB to use another field to join table B. 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
