hi there,
I've got a suitable solution -- found this out by using MiddleGen to generate mapping files (great tool!)
I've got my composite-id tag defined as follows:
Code:
<composite-id name="Pk" class="OrderItemPk, DB">
<key-property name="SequenceNumber" column="SEQ_NR" />
<key-property name="OrderSequenceNumber" column="FK_ORDR_SEQ_NR" />
<key-property name="UserSequenceNumber" column="FK_ORDR_USER_SEQ_NR" />
</composite-id>
Further down I define my composite foreign key (using the
update="false" and
insert="false" tags) referencing the same columns:
Code:
<many-to-one name="Order" class="Order, DB" update="false" insert="false">
<column name="FK_ORDR_SEQ_NR" />
<column name="FK_ORDR_USER_SEQ_NR" />
</many-to-one>
This allows me to define a complex primary-key, and still use parts of the primary key in relationships.
thanks,
Manoj