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 Da...@wellsfargo.com on 2003/08/18 15:01:37 UTC

Compound Primary Key foreign key references

All,

   From what I can tell, the repository.dtd is not sufficient to uniquely
reference an object with a compound primary key.  I think I must be missing
something.  In the contrived example below the foreign keys used to
reference class B are keyA and keyB.  Unfortunately, the names of keyA and
keyB are NOT the same names inside classB.  How do I configure refB to tell
it that keyA references classB.secondKey and that keyB references
classB.firstKey or vica-versa.  I am a little unclear on how to make the
distinction explicit.  Any help will be appreciated.

- Dan

<class-descriptor 
  class="mypackage.ClassA"
  table="tableA"
>
  <field-descriptor
    name="id"
    column="id"
    jdbc-type="INTEGER"
    primarykey="true"
  />
  <field-descriptor
    name="keyA"
    column="keyA"
    jdbc-type="INTEGER"
  />
  <field-descriptor
    name="keyB"
    column="keyB"
    jdbc-type="INTEGER"
  />
  <reference-descriptor
     name="refB"
     class-ref="mypackage.ClassB"
  >
     <foreignkey field-ref="keyA"/>
     <foreignkey field-ref="keyB"/>
  </reference-descriptor>
</class-descriptor>


<class-descriptor 
  class="mypackage.ClassB"
  table="tableB"
>
  <field-descriptor
    name="firstKey"
    column="firstKey"
    jdbc-type="INTEGER"
    primarykey="true"
  />
  <field-descriptor
    name="secondKey"
    column="secondKey"
    jdbc-type="INTEGER"
    primarykey="true"
  />
</class-descriptor>

> __________________________________________________
> Daniel B. Brown | WELLS FARGO BANK MINNESOTA, N.A. |
> Software Architect | http://www.wellsfargo.com  | MAC N2702-011 | 
> 9062 Old Annapolis Road | Columbia | MD | 21045-1951 | 
>         p: 410.884.2034 | f: 410.715.2325 | daniel.b.brown@wellsfargo.com
> |
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org