Hibernate mapping problem

G

garhone

Hi,

I've having trouble mapping a class with a composite key, part or all
of which are foreign keys, with a many-to-one relationship

class Mod {
private Integer codNum;
private Integer podNum;
}

class Cod {
private Integer codNum;
}

class Pod {
private Integer podNum;
}

The primary key of Mod is composed of codNum and podNum, which are
foreign keys to Pod and Cod, where Mod <- many-to-one -> Cod, and Mod
<- many-to-one -> Pod

If this is Mod.hbm.xml
<composite-id>
<key-property name="codNum" type="integer" column="cod_num" />
<key-property name="podNum" type="integer" column="pod_num" />
</composite-id>

How can I express the many-to-one relationship(s) and the class each
property belongs to?

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top