I have generated hibernate mappings(hbm file) of two table OMS_DLY_FLT_SCHD and OMS_DLY_FLT_SCHD_BELT using MyEClipse(4.1M1) but while running the application I am getting the following exception
org.hibernate.MappingException: Foreign key (FK4163A8F584DD3B2C:OMS_DLY_FLT_SCHD_BELT [FLT_NO])) must have same number of columns as the referenced primary key (OMS_DLY_FLT_SCHD [FLT_CD,FLT_DT,FLT_NO])
Table OMS_DLY_FLT_SCHD has <one- to- many> relationship with OMS_DLY_FLT_SCHD_BELT table. OMS_DLY_FLT_SCHD table has a composite primary key made with FLT_CD, FLT_DT and FLT_NO columns which are also referred for making of composite primary key of table OMS_DLY_FLT_SCHD_BELT with another column BELT_CD. Generated mapping files are given bellow
/******************* OmsDlyFltSchd.hbm.xml *********************/
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Thu Dec 08 19:47:05 IST 2005 -->
<hibernate-mapping package="com.unisys.bcia.omms.common.DTO">
<class name="OmsDlyFltSchdDTO" table="OMS_DLY_FLT_SCHD">
<composite-id name="id" class="OmsDlyFltSchdKey">
<key-property name="fltCd" column="FLT_CD" type="long"/>
<key-property name="fltDt" column="FLT_DT" type="date"/>
<key-property name="fltNo" column="FLT_NO" type="string"/>
</composite-id>
<property name="vipFltCd" column="VIP_FLT_CD" type="long" />
<property name="vipEntrgSize" column="VIP_ENTRG_SIZE" type="short" />
<property name="createdOn" column="CREATED_ON" type="date" />
<property name="createdBy" column="CREATED_BY" type="string" />
<property name="modifiedOn" column="MODIFIED_ON" type="date" />
<property name="modifiedBy" column="MODIFIED_BY" type="string" />
<set name="omsDlyFltSchdBeltSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdBeltDTO"/>
</set>
<set name="omsDlyFltSchdBelt1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdBeltDTO"/>
</set>
<set name="omsDlyFltSchdBelt2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdBeltDTO"/>
</set>
</class>
</hibernate-mapping>
/******************* OmsDlyFltSchdBelt.hbm.xml *********************/
<?xml version="1.0" encoding='UTF-8'?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<!-- DO NOT EDIT: This is a generated file that is synchronized -->
<!-- by MyEclipse Hibernate tool integration. -->
<!-- Created Thu Dec 08 19:47:06 IST 2005 -->
<hibernate-mapping package="com.unisys.bcia.omms.common.DTO">
<class name="OmsDlyFltSchdBeltDTO" table="OMS_DLY_FLT_SCHD_BELT">
<composite-id name="id" class="OmsDlyFltSchdBeltKey">
<key-property name="beltCd" column="BELT_CD" type="string"/>
<key-many-to-one name="omsDlyFltSchd" column="FLT_CD"
class="OmsDlyFltSchdDTO"/>
<key-many-to-one name="omsDlyFltSchd1" column="FLT_DT"
class="OmsDlyFltSchdDTO"/>
<key-many-to-one name="omsDlyFltSchd2" column="FLT_NO"
class="OmsDlyFltSchdDTO"/>
</composite-id>
<property name="firstBagDtTime" column="FIRST_BAG_DT_TIME"
type="timestamp" />
<property name="lastBagDtTime" column="LAST_BAG_DT_TIME"
type="timestamp" />
<property name="beltRsrcIndc" column="BELT_RSRC_INDC" type="string" />
<property name="beltSeqNo" column="BELT_SEQ_NO" type="short" />
<property name="createdOn" column="CREATED_ON" type="date" />
</class>
</hibernate-mapping>
Please help me.
SudiptaH@skytechsolutions.co.in