The collection descriptor needs to be in the 1 side, not the n side...

eg.

say you had project - task mapping (1 - n respectively)

If in the task table you have fk_project_id, and project has id, and in your
classes Project.java has id and tasks field, and Task.java has projectId,
and in the repository for Task you have:

<field-descriptor name="projectId" column="fk_project_id"
jdbc-type="INTEGER"/>

And for Project you have:

<collection-descriptor name="tasks" element-class-ref="Task">
    <inverse-foreignkey field-ref="projectId"/>
</collection-descriptor>


Is this what you have?

I dont think you need to have it as a foreign key, and you dont have to have
the reference desctiptor that would form the reverse mapping to above.

If you're still not sure, then send the relevant parts of repository.xml to
the list.

Daniel.


> -----Original Message-----
> From: Wolfgang Schmiesing [mailto:[EMAIL PROTECTED]
> Sent: 20 May 2004 00:43
> To: [EMAIL PROTECTED]
> Subject: help with 1:n mapping
>
>
> Hi,
>
> I already posted my problem with a 1:n mapping earlier. I'm still
> having problems. I set up the repository according to the
> tutorials with a collection descriptor for the "n" side and an
> inverse foreign key attribute in the other class descriptor. Do I
> have to add an explicit foreign key in my SQL database for the
> inverse foreign key attribute? Or do I have to add a reference
> descriptor in the referenced class' class descriptor'?
> Java is complaining that it cannot find the column "project_id"
> which is the foreign key attribute although I checked that it's
> in the table and contains the correct values.
> Or can the class name "Project" be the problem as there is
> already a class named "Project" in the test suite (although I
> commented all the test stuff out in repository.xml)?
>
> Please help me, I need this mapping to be done.
>
> ---------------------------------------------------------------------
> 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