I have two tables with parent/child relation. Child have a table with two columns. Originally Primary key value of child table was same as parent tables Primary key value. I have defined it in child table’s hbm like this..
<id name="c1" type="int">
<column name="column1"/>
<generator class="foreign"/>
<param name="property">column1</param>
</generator>
</id>
Now second column ( defined as below ) in Child table is also part of primary key.
<many-to-one name="c2" class="com.Column2" fetch="select">
<column name="column2" not-null="true"/>
</many-to-one>
So I have to make a composite-id in hbm and basically have these both columns define in it, but composit-id probably doesn’t support generator id something like what I am trying to do
<composite-id>
<key-many-to-one name="c1" column="column1"/>
<key-many-to-one name="c2" column="column2"/>
</composite-id>
But it seems composite-id doesn’t support auto-generated(first1) type of column. So my question is how to for a composit-id in hbm file with one column using generator class and one in “many-to-one” mapping…