-->
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.  [ 3 posts ] 
Author Message
 Post subject: Foreign key (FK2BED736C71ADB01A:EMPO.FK_LIC_TCH__REF_83747_L
PostPosted: Fri Aug 24, 2012 1:43 pm 
Newbie

Joined: Fri Aug 24, 2012 1:28 pm
Posts: 2
Foreign key (FK2BED736C71ADB01A:EMPO.FK_LIC_TCH__REF_83747_LICENSE) must have same number of columns as the referenced primary key LICENSE

iam getting error like above
below are my mapping files

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping assembly="CGI.ESG.TEMPO.DomainEntity" namespace="CGI.ESG.TEMPO.DomainEntity" xmlns="urn:nhibernate-mapping-2.2">
<class name="LICENSE" table="LICENSE" lazy="true" >
<composite-id name="Keys" class="LicenseKey">
<key-property name="MASTER_LICENSE_ID" column="MASTER_LICENSE_ID" />
<key-property name="INT_DOC_ID" column="INT_DOC_ID" />
</composite-id>
<many-to-one name="MTB_EL_LICENSE_TYPE" class="MTB_EL_LICENSE_TYPE" insert="true" update="true">
<column name="ACTIVITY_TYPE_CODE" sql-type="CHAR" not-null="true" />
<column name="ACTIVITY_CLASS_CODE" sql-type="CHAR" not-null="true" />
<column name="PROGRAM_CODE" sql-type="CHAR" not-null="true" />
<column name="ACTIVITY_CATEGORY_CODE" sql-type="CHAR" not-null="true" />
</many-to-one>

<property name="UPGRADED_LICENSE_ID">
<column name="UPGRADED_LICENSE_ID" sql-type="NUMBER" not-null="false" />
</property>

<many-to-one name="AGENCY_INTEREST" class="AGENCY_INTEREST" insert="true" update="true">
<column name="MASTER_AI_ID" sql-type="NUMBER" not-null="true" />
<column name="AI_INT_DOC_ID" sql-type="NUMBER" not-null="true" />
</many-to-one>

<many-to-one name="MTB_EL_EXEMPTION_TYPE" class="MTB_EL_EXEMPTION_TYPE" insert="true" update="true">
<column name="EXEMPTION_TYPE_CODE" sql-type="VARCHAR2" not-null="false" />
</many-to-one>

<property name="ACTIVITY_YEAR">
<column name="ACTIVITY_YEAR" sql-type="NUMBER" not-null="true" />
</property>
<property name="ACTIVITY_NUM">
<column name="ACTIVITY_NUM" sql-type="NUMBER" not-null="true" />
</property>
<property name="APPLICATION_FLAG">
<column name="APPLICATION_FLAG" sql-type="CHAR" not-null="false" />
</property>
<property name="ELIGIBLE_FOR_RENEWAL_FLAG">
<column name="ELIGIBLE_FOR_RENEWAL_FLAG" sql-type="CHAR" not-null="false" />
</property>
<property name="TCH_START_DATE">
<column name="TCH_START_DATE" sql-type="DATE" not-null="false" />
</property>
<property name="TCH_END_DATE">
<column name="TCH_END_DATE" sql-type="DATE" not-null="false" />
</property>
<property name="INSTRUCTOR_NAME">
<column name="INSTRUCTOR_NAME" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="EMPLOYER_NAME">
<column name="EMPLOYER_NAME" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="USER_LAST_UPDT">
<column name="USER_LAST_UPDT" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="TMSP_LAST_UPDT">
<column name="TMSP_LAST_UPDT" sql-type="DATE" not-null="true" />
</property>
<property name="USER_CREATED">
<column name="USER_CREATED" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="TMSP_CREATED">
<column name="TMSP_CREATED" sql-type="DATE" not-null="true" />
</property>
<bag name="LIC_OPERATOR_AI_XREFS" inverse="true" cascade="none">
<key>
<column name="MASTER_LICENSE_ID" sql-type="NUMBER" not-null="true" />
<column name="INT_DOC_ID" sql-type="NUMBER" not-null="true"/>
</key>
<one-to-many class="LIC_OPERATOR_AI_XREF" />
</bag>
<!--<bag name="LIC_TCH_EVENT_ROSTERS" inverse="true" cascade="none" >
<key>
<column name="TCH_ID" sql-type="NUMBER" not-null="true" />
<column name="SEQUENCE_NUM" sql-type="NUMBER" not-null="true"/>
</key>
<one-to-many class="LIC_TCH_EVENT_ROSTER" />
</bag>-->
</class>
</hibernate-mapping>

<?xml version="1.0" encoding="utf-8"?>
<hibernate-mapping assembly="CGI.ESG.TEMPO.DomainEntity" namespace="CGI.ESG.TEMPO.DomainEntity" xmlns="urn:nhibernate-mapping-2.2">
<class name="LIC_TCH_EVENT_ROSTER" table="LIC_TCH_EVENT_ROSTER" lazy="true" >
<composite-id name="Keys" class="EventRosterKey">
<key-property name="TCH_ID" column="TCH_ID" />
<key-property name="SEQUENCE_NUM" column="SEQUENCE_NUM" />
</composite-id>
<property name="MASTER_AI_ID">
<column name="MASTER_AI_ID" sql-type="NUMBER" not-null="false" />
</property>

<many-to-one name="LICENSE" class="LICENSE" lazy="false" insert="false" update="false">
<column name="MASTER_LICENSE_ID" sql-type="NUMBER" not-null="false" />
<column name="INT_DOC_ID" sql-type="NUMBER" not-null="false" />
</many-to-one>
<property name="AI_INT_DOC_ID">
<column name="AI_INT_DOC_ID" sql-type="NUMBER" not-null="false" />
</property>
<property name="MASTER_LICENSE_ID">
<column name="MASTER_LICENSE_ID" sql-type="NUMBER" not-null="false" />
</property>
<property name="INT_DOC_ID">
<column name="INT_DOC_ID" sql-type="NUMBER" not-null="false" />
</property>
<property name="CREDIT_HOURS">
<column name="CREDIT_HOURS" sql-type="NUMBER" not-null="false" />
</property>
<property name="APPLIED_HOURS">
<column name="APPLIED_HOURS" sql-type="NUMBER" not-null="false" />
</property>
<property name="NON_CERTIFIED_FLAG">
<column name="NON_CERTIFIED_FLAG" sql-type="VARCHAR2" not-null="false" />
</property>
<property name="USER_LAST_UPDT">
<column name="USER_LAST_UPDT" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="TMSP_LAST_UPDT">
<column name="TMSP_LAST_UPDT" sql-type="DATE" not-null="true" />
</property>
<property name="USER_CREATED">
<column name="USER_CREATED" sql-type="VARCHAR2" not-null="true" />
</property>
<property name="TMSP_CREATED">
<column name="TMSP_CREATED" sql-type="DATE" not-null="true" />
</property>
</class>
</hibernate-mapping>


Top
 Profile  
 
 Post subject: Re: Foreign key (FK2BED736C71ADB01A:EMPO.FK_LIC_TCH__REF_83747_L
PostPosted: Fri Aug 24, 2012 2:23 pm 
Newbie

Joined: Wed Aug 22, 2012 11:52 pm
Posts: 4
LIC_TCH_EVENT_ROSTER hbm file many-to-one mapping is wrong. you need to map with the composite-id class

<many-to-one name="LICENSE" class="LICENSE" lazy="false" insert="false" update="false">
<column name="MASTER_LICENSE_ID" sql-type="NUMBER" not-null="false" />
<column name="INT_DOC_ID" sql-type="NUMBER" not-null="false" />
</many-to-one>


Top
 Profile  
 
 Post subject: Re: Foreign key (FK2BED736C71ADB01A:EMPO.FK_LIC_TCH__REF_83747_L
PostPosted: Fri Aug 24, 2012 2:55 pm 
Newbie

Joined: Fri Aug 24, 2012 1:28 pm
Posts: 2
i do not have composite ids and could you please correct my mapping file


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.