I have a many-to-many association defined as follows:
Code:
<set name="activationCode2package" table="activation_code2package">
<key column="activation_code_id"/>
<composite-element class="ActivationCode2Package">
<property name="isCrashed" type="boolean" column="is_crashed"/>
<property name="useDate" type="timestamp" column="use_date"/>
<many-to-one name="pkg" class="Package" column="package_id"/>
</composite-element>
</set>
and
Code:
<set name="activationCode2package" table="activation_code2package">
<key column="package_id"/>
<composite-element class="ActivationCode2Package">
<property name="isCrashed" type="boolean" column="is_crashed"/>
<property name="useDate" type="timestamp" column="use_date"/>
<many-to-one name="activationCode" class="ActivationCode" column="activation_code_id"/>
</composite-element>
</set>
Obviously the primary key of the bridge table (package2activation_code) must be "pkg + activation_code"...
But... When I create DB with SchemaExport this table doesn't have primary key!