Thread: <join>: <key>: different composite key

oneview member: CatchSandeepVaid CatchSandeepVaid
07/07/2009

 I have Bond domain class which maps to 2 tables viz. BOND nad BONDBASIC. The composite-key of both these tables are different.
 
 BOND -----> INVESTMENTID, USECODE, STARTTIME (as composite-key)
 BONDBASIC ----> INVESTMENTID, INVESTMENTID2, STARTTIME, TYPE (as composite-key)
 
 NOTE: This is a legacy database, which i cannot change..
 
 In bond.hbm.xml:
 
 <class name="BondBO" table="TBINVESTMENTPERIOD" optimistic-lock="version" >
   <composite-id name="compBondBO" class="CompBondBO">
    <key-property name="investmentId" column="INVESTMENTID"/>
    <key-property name="useCode" column="USECODE"/>
    <key-property name="startTime" column="STARTTIME"/>
   </composite-id>
   
   <version unsaved-value="undefined" name="version" column="VERSION" type="com.tietoenator.lis.common.db.Db2Timestamp" />
   
   <join table="BONDBASIC">
    <key>
      <!-- <column name="INVESTMENTID"></column>-->
      <!-- <column name="STARTTIMESTAMP"></column>-->
     </key>
    </join>
</class>

  How to specify the FK and PK of BONDBASIC ?

 
To answer to a comment, you have to become a member of this group