Hi,
Figured it for the Table A & Table C relationship. But i removed the one-to-many from A->C and have a bidirectional one-to-one.
Table A mapping :
Code:
< class name="ParentClass" ...>
...
<id name="APK" type="long">
<column name="TABLE_A_KEY_COL" precision="12" scale="0" />
<generator class="sequence">
<param name="sequence">TABLE_A_PK_SEQ</param>
</generator>
</id>
...
<one-to-one name="ChildClass"
class="ChildClass"
cascade="all" />
...
</class>
Table C mapping:
Code:
<class name="ChildClass" ...
...
<id name="CFK" type="long" unsaved-value="null">
<column name="TABLE_C_KEY_COL" precision="12" scale="0" />
<generator class="foreign">
<param name="property">ParentClass</param>
</generator>
</id>
...
<one-to-one
name="ParentClass"
class="ParentClass"
cascade="all"
constrained="true"
/>
....
</class>
This mapping automatically generates the APK using a oracle sequence and that sequence number is used for Table C
Now should try how it works for the composite id of Table B.
Thanks,
Uma.