Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8157955
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T17:27:52+00:00 2026-06-06T17:27:52+00:00

I have a five tables and their respective column university – id_university (pk) –

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T17:27:55+00:00Added an answer on June 6, 2026 at 5:27 pm

    since the primar key of the tables are more than one column you will need to map them as compositeId

    <composite-id>
      <key-property name="id" column="id_university" />
      <key-reference name="country" column="id_country" />
    </id>
    

    except the ids are unique on their own then it would be easier all around to map them as id. The references are mapped like this.

    <many-to-one name="country" column="id_country" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have five models and their respective tables are Member:id,fname,lname Student:id,member_id(foreign key references member
I have five tables in my database. Members, items, comments, votes and countries. I
I have five tables that are fairly similar in structure but different enough that
Lets say I have five tables named table1, table2 ... table5. I have already
I have a MySQL database with a few (five to be precise) huge tables.
I have five tables: tab_template template_group group user_group user Tab_template's are organized into groups
I have five tables: models : id, name, specification models_networks : id, model_id, network_id
I have written some SQL code to create five tables with several relations(foreign keys).
I have a database with five tables in an Android application. I have been
I have the following five tables: ISP Product Connection AddOn AddOn/Product (pivot table for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.