Hi,
I'll try to explain my problem in a simple example:
I have two tables:
Person---> id(pk), name, person_number
Test--> test_number(pk), person_number(pk),
What I want to do is to map person_number in Test with person_number in Person using Hibernate mapping file.
I've tried:Code:
<hibernate-mapping package="xxx">
<class name="Test" table="TEST" >
<composite-id name="id" class="TestId">
<key-property name="testNumber" type="int" column="TEST_NUMBER"/>
<key-many-to-one name="person" class="Person" column="PERSON_NUMBER" property-ref="personNumber"/>
</composite-id>
</class>
</hibernate-mapping>
It works when outside the composite id, but that's not an accepted solution:Code:
<hibernate-mapping package="xxx">
<class name="Test" table="TEST" >
<composite-id name="id" class="TestId">
<key-property name="testNumber" type="int" column="TEST_NUMBER"/>
..some more...
</composite-id>
<many-to-one name="person" class="Person" column="PERSON_NUMBER" property-ref="personNumber"/>
</class>
</hibernate-mapping>
Can anyone help? Been stuck on this for a while now:)