My question was the later.  I could not find the behavior in the
documentation.

Thanks,

- Dan

-----Original Message-----
From: Ron Gallagher [mailto:[EMAIL PROTECTED]
Sent: Monday, August 18, 2003 9:53 AM
To: OJB Users List
Subject: Re: Compound Primary Key foreign key references


Dan --

Are you asking this question because you've tried this configuration and it
doesn't work, or are you just confused as to how OJB will handle this
situation?  If the former, then please provide more info regarding the
problems you're having.  If the latter, then here's my explanation...

Anytime ojb encounters a reference-descriptor, it matches up the foreignkey
elements, one for one, with the primary key field-descriptors in the
referenced class.   This matching process pairs up foreignkey and
field-descriptor elements in the same order that they appear in the
repository.  So, in your case, the property mypackage.ClassA::keyA will be
matched up with the property mypackage.ClassB::firstKey, and the property
mypackage.ClassA::keyB will be matched up with the property
mypackage.ClassB::secondKey

Ron Gallagher
Atlanta, GA
[EMAIL PROTECTED]

> 
> From: [EMAIL PROTECTED]
> Date: 2003/08/18 Mon AM 09:01:37 EDT
> To: [EMAIL PROTECTED]
> Subject: 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 |
[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]

Reply via email to