I have two tables called "ActivityTest and "Batch" were both carrying Composite Keys in DB.
the mapping file for the 'ActivityTest' is as follows:
<hibernate-mapping>
<class name="hibernateorm.ActivityTest" table="activity_test">
<composite-id name="activityTestCPK" class="hibernateorm.ActivityTestCPK">
<key-property name="activityTestId" type="int" column="activity_test_id"/>
<key-many-to-one class="hibernateorm.PeriodActivity" name="periodActivity"/>
<key-many-to-one class="hibernateorm.Batch" name="batch" column="batch_id"/>
</composite-id>
<property name="dateTime" type="java.sql.Timestamp" column="activity_test_datetime"/>
.....
</hibernate-mapping>
and Batch mapping file looks like:
<hibernate-mapping>
<class name="hibernateorm.Batch" table="batch">
<composite-id name="batchCPK" class="hibernateorm.BatchCPK">
<key-property name="batchId" column="batch_id" type="int"/>
<key-many-to-one name="activityTest" class="hibernateorm.ActivityTest" column="activity_test_id"/>
</composite-id>
<property name.../>
..........
</hibernate-mapping>
because foreign key "batch" itself is composite Key ,hibernate throws error
as org.hibernate.MappingException can some body help on this ! advance thanks for the help.
[ Edited to remove abbreviation in topic title - Paul Sturrock ]
[ March 05, 2007: Message edited by: Paul Sturrock ]
the mapping file for the 'ActivityTest' is as follows:
<hibernate-mapping>
<class name="hibernateorm.ActivityTest" table="activity_test">
<composite-id name="activityTestCPK" class="hibernateorm.ActivityTestCPK">
<key-property name="activityTestId" type="int" column="activity_test_id"/>
<key-many-to-one class="hibernateorm.PeriodActivity" name="periodActivity"/>
<key-many-to-one class="hibernateorm.Batch" name="batch" column="batch_id"/>
</composite-id>
<property name="dateTime" type="java.sql.Timestamp" column="activity_test_datetime"/>
.....
</hibernate-mapping>
and Batch mapping file looks like:
<hibernate-mapping>
<class name="hibernateorm.Batch" table="batch">
<composite-id name="batchCPK" class="hibernateorm.BatchCPK">
<key-property name="batchId" column="batch_id" type="int"/>
<key-many-to-one name="activityTest" class="hibernateorm.ActivityTest" column="activity_test_id"/>
</composite-id>
<property name.../>
..........
</hibernate-mapping>
because foreign key "batch" itself is composite Key ,hibernate throws error
as org.hibernate.MappingException can some body help on this ! advance thanks for the help.
[ Edited to remove abbreviation in topic title - Paul Sturrock ]
[ March 05, 2007: Message edited by: Paul Sturrock ]