Hi. This one's a bummer.
I have a mapping table (let's call it mappingTable), used to map a many-to-many list of child entities within a parent entity. The parent's .hbm.xml relationship looks like this :
<list name="children" lazy="true" table="mappingTable" cascade="all">
<key column="parentId"/>
<index column="id"/>
<many-to-many column="childId" class="com.Child"/>
</list>
Problem : When a transaction commits (after having called parent.setChildren()), a SQLException is thrown beacause no unique constraint for mappingTable has been defined (i.e. mappingTable's sequence is undefined, and is not being incremented after each child insert)
I have defined this sequence in Oracle, but cannot find where to declare it in my hibernate List mapping.
Any help greatly appreciated!
Donovan
|