我有五个表和它们各自的列
大学
- id_university (pk)
- id_country (pk) ---- FK ---- country.id_country
- univ_code
- univ_name
- id_update FK ---- update.id_update
研究所
- id_institute (pk)
- id_country (pk) ---- FK ---- country.id_country
- id_univ
- id_address FK ---- update.id_update
地址
- id_address
- id_country (pk) ---- FK ---- country.id_country
- addressfield
国家
- id_country
更新
- id_update
id_country (pk) ---- FK ---- country.id_country
这些是 hbm 映射
<class name="xxxxxx" table="university">
<id name="id_university " column="id_university ">
<generator class="increment" />
</id>
<property name="id_country ">
<column name="id_country " />
</property>
<property name="univ_code">
<column name="univ_code" />
</property>
<property name="univ_name">
<column name="univ_name" />
</property>
<property name="id_update">
<column name="id_update" />
</property>
</class>
<class name="xxxxxx" table="institute">
<id name="id_institute " column="id_institute ">
<generator class="increment" />
</id>
<property name="id_country ">
<column name="id_country " />
</property>
<property name="id_univ">
<column name="id_univ" />
</property>
<property name="id_address">
<column name="id_address" />
</property>
<property name="id_update">
<column name="id_update" />
</property>
</class>
<class name="xxxxxx" table="address">
<id name="id_address " column="id_address ">
<generator class="increment" />
</id>
<property name="id_country ">
<column name="id_country " />
</property>
<property name="addressfield">
<column name="addressfield" />
</property>
</class>
<class name="xxxxxx" table="address">
<id name="id_address " column="id_address ">
<generator class="increment" />
</id>
<property name="id_country ">
<column name="id_country " />
</property>
<property name="addressfield">
<column name="addressfield" />
</property>
</class>
由于存在外键关系,有人可以指导我使用休眠映射。我无法获得正确的映射。