I have a five tables and their respective column
university
- id_university (pk)
- id_country (pk) ---- FK ---- country.id_country
- univ_code
- univ_name
- id_update FK ---- update.id_update
institute
- id_institute (pk)
- id_country (pk) ---- FK ---- country.id_country
- id_univ
- id_address FK ---- update.id_update
address
- id_address
- id_country (pk) ---- FK ---- country.id_country
- addressfield
country
- id_country
update
- id_update
id_country (pk) ---- FK ---- country.id_country
These are the hbm mappings
<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>
As there are foreign key relationships, can somebody guide me with hibernate mapping. I am unable to get the correct mapping.