If you have two Objects with a many-to-many relationship, and the association object contains additional (Extra) data - which is defined for the relationship itself, the correct way to map this would be to treat the association table as a top-level object.
Object A and B each have a one-to-many to AB and AB has 2 many-to-one associations - one to A and one to B.
Code:
<class name="A"...
<id name="id" column="id" access="field">
<generator class="increment" />
</id>
...
<set name="abs">
<key column="A_ID"/>
<one-to-many class="AB"/>
</set>
</class>
<class name="B"...>
<id name="id" column="id" access="field">
<generator class="increment" />
</id>
...
<set name="abs>
<key column="B_ID"/>
<one-to-many class="AB"/>
</set>
</class>
<class name="AB"...>
...
<many-to-one name="A" column="A_ID"/>
<many-to-one name="B" column="B_ID"/>
</class>
You would need to determine the proper inverse="" and cascade="" options for your particular model.
Section
7.3.3 Ternary Associations mentions this briefly
"A second approach is to simply remodel the association as an entity class. This is the approach we use most commonly."
and also provides two alternatives.