If Parent has primary key composed of a and b, and Child has primary key composed of a and c, how does one map this on a join table? looking at the documentation I tried what was suggested for many-to-many, but it doesn't work
Code:
<list name="childs" table="ParentChild">
<key>
<column name="A" />
<column name="B" />
</key>
<list-index column="idx" base="0"/>
<many-to-many class="Child"
unique="true" >
<formula>A</formula>
<column name="C" />
</many-to-many>
</list>
this fails with a sql exception about invalid column index when inserting the join table row, after inserting the child. i think what is happening is because I am joining 2 tables with 2-tuple primary keys, it is expecting 4 columns to be in the join table (+1 for idx). But because one is shared, there should only be 3 (+1 for index). The sql that hibernate generates looks good "insert into ParentChild (A, B, idx, C) values (?, ?, ?, ?)" but I get the mentioned sql exception.
When i step thru with the debugger, I see A getting set on the prepared statement, then B, then A again, then C, at which point it dies (because it tries to set the 5th parameter on the PS, when there are only 4, hence the invalid column...)