You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by No...@bmi.gv.at on 2003/12/02 14:01:50 UTC

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: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org