Hello,
I'm having trouble establishing a simple one-to-one relationship using a foreign key.
This is not well documented in the Hibernate2 documentation, but I did find this in the tips and tricks section:
Code:
<generator class="foreign">
<param name="property">parent</param>
</generator>
However, what is parent supposed to be? This is what i have currently, but when i do a simple save(chart), no record is inserted into the table.
Code:
<class name="com.catalepse.patientity.models.Person" table="PERSON">
<id name="personId" type="long" column="PERSON_ID" unsaved value="null" >
<generator class="identity"/>
</id>
<joined-subclass name="Patient" table="PATIENT">
<key column="PERSON_ID"/>
<one-to-one name="chart" cascade="all" constrained="true"/>
</joined-subclass>
</class>
<class name="Chart" table="CHART">
<id name="personId" type="integer" column="PERSON_ID" unsaved-value="null" >
<generator class="foreign">
<param name="property">patient</param>
</generator>
</id>
<one-to-one name="patient"/>
</class>