Using the PersistenceBroker API...
I have a class that has a 1:n relationship -> a project can have many principal investigators.
The class descriptors look like this:


<class-descriptor class="org.jlab.mis.services.mics.client.generated.Project" 
table="projects">
   <field-descriptor name="id" column="PROJECT_ID" jdbc-type="VARCHAR"/>
   <field-descriptor name="label" column="REPO_CODE" jdbc-type="VARCHAR" primarykey="true" 
access="anonymous" />
   <field-descriptor name="fiscalYear" column="FISCAL_YEAR" jdbc-type="VARCHAR" 
primarykey="true" />
   <field-descriptor name="name" column="PROJECT_NAME" jdbc-type="VARCHAR" />
   <collection-descriptor name="primaryInvestigators" 
element-class-ref="org.jlab.mis.services.mics.client.generated.PrimaryInvestigator" 
auto-retrieve="false">
     <inverse-foreignkey field-ref="projectId" />
     <inverse-foreignkey field-ref="fiscalYear" />
   </collection-descriptor>
 </class-descriptor>

<class-descriptor class="org.jlab.mis.services.mics.client.generated.PrimaryInvestigator" 
table="pis">
   <field-descriptor name="id" column="PERSON_ID" jdbc-type="VARCHAR" 
primarykey="true"/>
   <field-descriptor name="firstName" column="FIRSTNAME" jdbc-type="VARCHAR" />
   <field-descriptor name="lastName" column="LASTNAME" jdbc-type="VARCHAR" />
   <field-descriptor name="email" column="EMAIL" jdbc-type="VARCHAR" />
   <field-descriptor name="fiscalYear" column="FISCAL_YEAR" jdbc-type="VARCHAR" 
access="anonymous" primarykey="true"/>
   <field-descriptor name="projectId" column="PROJECT_ID" jdbc-type="VARCHAR" 
access="anonymous" />
 </class-descriptor>

The problem is, whenever OJB tries to retrieve a collection of Primary Investigators, it never uses the correct value for the composite primary key.
The debugging output looks like this:


[org.apache.ojb.broker.accesslayer.JdbcAccessImpl] DEBUG: executeQuery : QueryByCriteria from class org.jlab.mis.services.mics.client.generated.PrimaryInvestigator where [projectId = 13179, fiscalYear = 13179]

As you can see, it is using the exact same value for the projectId and fiscalYear attributes.
What am I doing wrong?


--
----------------------------
Bobby Lawrence
MIS Application Developer

Jefferson Lab (www.jlab.org)

Email: [EMAIL PROTECTED]
Office: (757) 269-5818
Pager: (757) 584-5818
----------------------------





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to