Hi;
HIA 6.3.1 say that for a 1:1 relationship (like Person:Address), the config is:
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<many-to-one name="address"
column="addressId"
cascade="all"
unique="true"/>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
</class>
While the docs at
http://www.hibernate.org/hib_docs/v3/re ... tional-121 (8.2.2) say it's:
<class name="Person">
<id name="id" column="personId">
<generator class="native"/>
</id>
<many-to-one name="address"
column="addressId"
unique="true"
not-null="true"/>
</class>
<class name="Address">
<id name="id" column="addressId">
<generator class="native"/>
</id>
</class>
So the question is... What are the correct settings for cascade and not-null when I have a table like Person where each row in person has exactly one matching row in Address?
And of the different approaches for 1:1 unidirectional mappings, where each Address row is owned by exactly 1 Person row - is this the best method? (HIA insinuates that this is the best approach - but never flat-out says it is.)
thanks - dave