Okay, I've been reading the documentation / forums for two days now and still have not been able to figure out my problem. I wish to map two objects in a one-to-one relationship. Both objects have composite-id's. I am looking for a simpler explanation, or maybe a pointer to some sample code that I can look at. ANY help would be greatly appreciated. I am in the process of migrating 60k lines of code from 1.2 - 2, and would like to avoid changing the structure as much as possible. I apologize in advance if this is a dumb question, but I have been unable to resolve this.
I am using hibernate 2.1.4
Here is an example of what I am trying now.
Code:
Object A has primaryKeys(key1,key2)
Object B has primaryKeys(key1,key2)
Mappings are such:
Code:
<class name="A" table="A" >
<composite-id unsaved-value="any">
<key-property name="key1" type="long"/>
<key-property name="key2" type="java.lang.String"/>
</composite-id>
<one-to-one name="B" class="B" cascade="all"/>
</class>
<class name="B" table="B" >
<composite-id unsaved-value="any">
<key-property name="key1" type="long"/>
<key-property name="key2" type="java.lang.String"/>
</composite-id>
</class>
Thanks,
-Jay