3 Replies Latest reply: Jan 18, 2013 7:16 AM by gimbal2 RSS

    joining table in hibernate

    824461
      Hi

      I have a requirement where I have to fetch the data from 2 table.
      table1 structure
      profileiId, name, address,........ there are some more elements (profile id is primary key)
      table2
      profileid, key there will be multiple key for a profileid. both columns make composite key.
      I have a hbm file
      <class name="Test" table="Table1">
              <id name="profileId" column="PROFILE_ID" type="string" unsaved-value="undefined">
                     <meta attribute="SCIguid"/>
              </id>
                <property name="name" column="NAME" type="string" unique="true"/>
                <property name="address" column="ADDRESS" type="String"/>
      .
      .
      .
      .
      I have to enhance this xml file to join table2 based on profileid and take all the keys in a List.
      Something like
      <property name="list" column="KEY" type="LIST" unique="true" table="table2" /> //join based on profileid
      Thanks for the help

      Edited by: 821458 on Jan 18, 2013 4:56 AM