Hi!
I have a textbook example of many-to-many bidirectional association. There's an author who creates items. The ordered end of the association is mapped using a list in the following manner (Item class):
Code:
<list name="Authors" table="CREATOR_C_ITEM" cascade="save-update">
<key column="ITEM_ID"/>
<index column="ITEM_POSITION"/>
<many-to-many class="Creator" column="CREATOR_ID"/>
</list>
The unordered end is (Creator Class):
Code:
<set name="ItemsCreated" table="CREATOR_C_ITEM" inverse="true" cascade="save-update">
<key column="CREATOR_ID"/>
<many-to-many class="Item" column="ITEM_ID"/>
</set>
I would expect the link table to have the PK consisting of ITEM_ID and ITEM_POSITION, but the ddl generated is a bit different:
Code:
create table CREATOR_C_ITEM (
ITEM_ID INTEGER not null,
CREATOR_ID INTEGER not null,
ITEM_POSITION INTEGER not null,
primary key (CREATOR_ID, ITEM_ID)
);
Thus not allowing any duplicate fields, which is a nonsense for that type of collection. I've tested it on the 1.2Beta3 and the recent 1.2CR1. What is wrong?