<2> XML Mapping Setting
public class Husband{
private int id;
private String name;
private Wife wife;
/*
* getting setting
*/
}
public class Wife{
private int id;
private String name;
/*
* gettting setting
*/
}
Husband.hmb.xml
<class name="com.lixing.hibernate.model.Husband" table="t_husband">
<id name="id">
<generator class="identity">
</id>
<property name="name"/>
<many-to-one name="wife" column="wifeId" unique="true" not-null="true"/>
</class>
Wife.hbm.xml
<class name="com.lixing.hibernate.model.Wife" table="t_wife">
<id name="id">
<generator class="identity">
</id>
<property name="name"/>
</class>