Hello Eric,
the descriptor as 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
What do I have to do to get this join?
Thanks,
Norbert.
-----Original Message-----
From: eric barbe [mailto:[EMAIL PROTECTED]
Sent: Freitag, 28. November 2003 15:08
To: OJB Users List
Subject: RE: Mapping question
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]