I don't think your answer applies in my case, as the <composite-element> is automatically creating keys. With regards to the example on page 229 of HiA, could you show us how you would do what you suggest? Here is the code:
Code:
<set name="items" lazy="true" table="CATEGORY_ITEMS">
<key column="CATEGORY_ID"/>
<composite-element class="CategorizedItem">
<parent name="category"/>
<many-to-one name="item" class="Item" column="ITEM_ID" not-null="true"/>
<property name="username" column="USERNAME" not-null="true"/>
<property name="dateAdded" column="DATE_ADDED" not-null="true"/>
</composite-element>
</set>
This code will make a comosite primary key out of all four columns: CATEGORY_ID, ITEM_ID, USERNAME and DATE_ADDED. However, I only want the comosite primary key to be made up of the two columns CATEGORY_ID and ITEM_ID. I still want the other two columns to be in the table and not-null, but I don't want them to be a part of the composite primary key. How do I do this?
Warmest regards, Matt