-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: org.hibernate.MappingException
PostPosted: Wed Dec 14, 2005 2:51 am 
Newbie

Joined: Wed Dec 14, 2005 1:46 am
Posts: 2
I am using Hibernate 3.0 and My EClipse Version 4.0.100 M1

Mapping has been generated by My EClipse but while i am running my application it's showing 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])
at org.hibernate.mapping.ForeignKey.alignColumns(ForeignKey.java:90)


Here OMS_DLY_FLT_SCHD table has a composite primary key(FLT_CD,FLT_DT,FLT_NO).This table has one to many relationship with OMS_DLY_FLT_SCHD_BELT table which also has a composite primary key(FLT_CD(FK),FLT_DT(FK),FLT_NO(FK),BELT_CD)

mappings are as follows


<?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="mvntIndc" column="MVNT_INDC" type="string" not-null="true" />
<property name="fltIndc" column="FLT_INDC" type="string" not-null="true" />
<property name="fltTailNo" column="FLT_TAIL_NO" type="string" />
<property name="schdOpTime" column="SCHD_OP_TIME" type="timestamp" not-null="true" />
<property name="estmdFltTime" column="ESTMD_FLT_TIME" type="timestamp" />
<property name="actFltTime" column="ACT_FLT_TIME" type="timestamp" />
<property name="trndFltCd" column="TRND_FLT_CD" type="long" />
<property name="trndFltNo" column="TRND_FLT_NO" type="string" />
<property name="trndOpCd" column="TRND_OP_CD" type="string" />
<property name="trmlCd" column="TRML_CD" type="string" />
<property name="maxNoPax" column="MAX_NO_PAX" type="short" />
<property name="sendAlCd" column="SEND_AL_CD" type="string" />
<property name="cdshrMstrFltNo" column="CDSHR_MSTR_FLT_NO" type="string" />
<property name="cdshrMstrOpCd" column="CDSHR_MSTR_OP_CD" type="string" />
<property name="paxHndlgOrgnCd" column="PAX_HNDLG_ORGN_CD" type="integer" />
<property name="dlySchdRmks" column="DLY_SCHD_RMKS" type="string" />
<property name="brdgOpenTime" column="BRDG_OPEN_TIME" type="timestamp" />
<property name="lastCallTime" column="LAST_CALL_TIME" type="timestamp" />
<property name="arriFnlTime" column="ARRI_FNL_TIME" type="timestamp" />
<property name="aprvdDeptTime" column="APRVD_DEPT_TIME" type="timestamp" />
<property name="engnStReqTime" column="ENGN_ST_REQ_TIME" type="timestamp" />
<property name="engnStTime" column="ENGN_ST_TIME" type="timestamp" />
<property name="paxOrmsOrgnCd" column="PAX_ORMS_ORGN_CD" type="integer" />
<property name="vipPaxNo" column="VIP_PAX_NO" type="short" />
<property name="dvrnReason" column="DVRN_REASON" type="string" />
<property name="dvrtDestArpt" column="DVRT_DEST_ARPT" type="string" />
<property name="rtnReason" column="RTN_REASON" type="string" />
<property name="airbridgeAtchTime" column="AIRBRIDGE_ATCH_TIME" type="timestamp" />
<property name="airbridgeDtchTime" column="AIRBRIDGE_DTCH_TIME" type="timestamp" />
<property name="lndgAbrtReason" column="LNDG_ABRT_REASON" type="string" />
<property name="lndgAbrtIndc" column="LNDG_ABRT_INDC" type="string" />
<property name="cancelStatus" column="CANCEL_STATUS" type="string" />
<property name="cancelDtTime" column="CANCEL_DT_TIME" type="timestamp" />
<property name="adhocFltFlag" column="ADHOC_FLT_FLAG" type="string" />
<property name="chkinDeskClsTime" column="CHKIN_DESK_CLS_TIME" type="timestamp" />
<property name="noLclPax" column="NO_LCL_PAX" type="short" />
<property name="noLclBags" column="NO_LCL_BAGS" type="short" />
<property name="totalBagWgt" column="TOTAL_BAG_WGT" type="float" />
<property name="noLclAdlt" column="NO_LCL_ADLT" type="short" />
<property name="noLclInfnt" column="NO_LCL_INFNT" type="short" />
<property name="noLclChld" column="NO_LCL_CHLD" type="short" />
<property name="noLclFirstClPax" column="NO_LCL_FIRST_CL_PAX" type="short" />
<property name="noLclBunsClPax" column="NO_LCL__BUNS_CL_PAX" type="short" />
<property name="noLclEconClPax" column="NO_LCL_ECON_CL_PAX" type="short" />
<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" />

<many-to-one name="omsAircraft" column="AIRCRAFT_IATA_CD" class="OmsAircraftDTO" not-null="true" />

<many-to-one name="omsAirline" column="AL_IATA_CD" class="OmsAirlineDTO" not-null="true" />

<many-to-one name="omsArpt" column="ARPT_CD" class="OmsArptDTO" />

<many-to-one name="omsStand" column="STAND_CD" class="OmsStandDTO" />

<many-to-one name="omsVipPrnl" column="VIP_PRN_CD" class="OmsVipPrnlDTO" />

<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>

<set name="omsDlyFltSchdChkSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdChkDTO"/>
</set>

<set name="omsDlyFltSchdChk1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdChkDTO"/>
</set>

<set name="omsDlyFltSchdChk2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdChkDTO"/>
</set>

<set name="omsDlyFltSchdChkinSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdChkinDTO"/>
</set>

<set name="omsDlyFltSchdChkin1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdChkinDTO"/>
</set>

<set name="omsDlyFltSchdChkin2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdChkinDTO"/>
</set>

<set name="omsDlyFltSchdChtSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdChtDTO"/>
</set>

<set name="omsDlyFltSchdCht1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdChtDTO"/>
</set>

<set name="omsDlyFltSchdCht2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdChtDTO"/>
</set>

<set name="omsDlyFltSchdDelaySet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdDelayDTO"/>
</set>

<set name="omsDlyFltSchdDelay1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdDelayDTO"/>
</set>

<set name="omsDlyFltSchdDelay2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdDelayDTO"/>
</set>

<set name="omsDlyFltSchdGateSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdGateDTO"/>
</set>

<set name="omsDlyFltSchdGate1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdGateDTO"/>
</set>

<set name="omsDlyFltSchdGate2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdGateDTO"/>
</set>

<set name="omsDlyFltSchdRteSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdRteDTO"/>
</set>

<set name="omsDlyFltSchdRte1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdRteDTO"/>
</set>

<set name="omsDlyFltSchdRte2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdRteDTO"/>
</set>

<set name="omsDlyFltSchdStandSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsDlyFltSchdStandDTO"/>
</set>

<set name="omsDlyFltSchdStand1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsDlyFltSchdStandDTO"/>
</set>

<set name="omsDlyFltSchdStand2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsDlyFltSchdStandDTO"/>
</set>

<set name="omsFltSvcPlanSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsFltSvcPlanDTO"/>
</set>

<set name="omsFltSvcPlan1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsFltSvcPlanDTO"/>
</set>

<set name="omsFltSvcPlan2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsFltSvcPlanDTO"/>
</set>

<set name="omsPtmEvtInfoSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsPtmEvtInfoDTO"/>
</set>

<set name="omsPtmEvtInfo1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsPtmEvtInfoDTO"/>
</set>

<set name="omsPtmEvtInfo2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsPtmEvtInfoDTO"/>
</set>

<set name="omsSvcsplPerfReptSet" inverse="true">
<key column="FLT_CD"/>
<one-to-many class="OmsSvcsplPerfReptDTO"/>
</set>

<set name="omsSvcsplPerfRept1Set" inverse="true">
<key column="FLT_DT"/>
<one-to-many class="OmsSvcsplPerfReptDTO"/>
</set>

<set name="omsSvcsplPerfRept2Set" inverse="true">
<key column="FLT_NO"/>
<one-to-many class="OmsSvcsplPerfReptDTO"/>
</set>
</class>

</hibernate-mapping>



and


<?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" />
<property name="createdBy" column="CREATED_BY" type="string" />
<property name="modifiedOn" column="MODIFIED_ON" type="date" />
<property name="modifiedBy" column="MODIFIED_BY" type="string" />
</class>

</hibernate-mapping>

Please help me.

_________________
sudipta halder

SkyTech Solutions
BIPPL Building A
Block EP & GP
Salt Lake
Kolkata -91


Top
 Profile  
 
 Post subject:
PostPosted: Wed Dec 14, 2005 4:17 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
this is getting funny ;)

Its about the 5th time a user is using myeclipse ide and the mappings doesnt work since they seem not to handle composite foreign keys.

The solution:
A. use hibernate tools to do the reverse engineering instead (it knows how to handle composite foreign keys)

B. Manually hand edit the hbm.xml to be correct

C. Go to myeclipseide forum/support and ask that they fix their mapping generation.

/max

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.