7.3.4. Ternary associations

There are three possible approaches to mapping a ternary association. One approach is to use a Map with an association as its index:
<map name="contracts">
    <key column="employer_id" not-null="true"/>
    <map-key-many-to-many column="employee_id" class="Employee"/>
    <one-to-many class="Contract"/>
</map>
<map name="connections">
    <key column="incoming_node_id"/>
    <map-key-many-to-many column="outgoing_node_id" class="Node"/>
    <many-to-many column="connection_id" class="Connection"/>
</map>
A second approach is to remodel the association as an entity class. This is the most common approach.
A final alternative is to use composite elements, which will be discussed later.