Originally posted by Luigi Rubino:
It's not clear how to configure a ternary association with Hibernate.
Some help?
Thanks,
Luigi
Collection Mapping Ternary Associations There are two possible approaches to mapping a ternary association. One approach is to use composite elements (discussed below). Another is to use a Map with an association as its index:
<map name="contracts" lazy="true">
<key column="employer_id"/>
<index-many-to-many column="employee_id" class="Employee"/>
<one-to-many column="contract_id" class="Contract"/>
</map>
<map name="connections" lazy="true">
<key column="node1_id"/>
<index-many-to-many column="node2_id" class="Node"/>
<many-to-many column="connection_id" class="Connection"/>
</map>
SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand