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
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