-->
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: collection foreign key mapping has wrong number of columns
PostPosted: Sat Nov 13, 2004 12:22 am 
Newbie

Joined: Sun Aug 08, 2004 11:04 pm
Posts: 5
Ug, this is probably an easy one for you guys. I just can't see it. I have two tables, ABSENCE_MASTER and ABSENCE_DETAIL. the absence_detail table is a composite key. Any ideas why I would be getting this error?

Hibernate version:
Hibernate 2.1

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>

<class
name="com.*.model.legacy.PrmAbsenceMaster"
table="ABSENCE_MASTER"
lazy="true"
>
<id
name="absenceId"
type="java.lang.String"
length="14"
column="ABSENCE_ID">
<generator class="assigned"/>
</id>
<property
name="level2"
type="java.lang.String"
column="LEVEL2"
length="4"
/>
<property
name="location2"
type="java.lang.String"
column="LOCATION2"
length="4"
/>
<property
name="hasScheduleYn"
type="java.lang.String"
column="HAS_SCHEDULE_YN"
length="1"
/>
<property
name="location5"
type="java.lang.String"
column="LOCATION5"
length="4"
/>
<property
name="level1"
type="java.lang.String"
column="LEVEL1"
length="4"
/>
<property
name="totalDays"
type="java.math.BigDecimal"
column="TOTAL_DAYS"
length="10"
/>
<property
name="adsSubject1"
type="java.lang.String"
column="ADS_SUBJECT1"
length="10"
/>
<property
name="location6"
type="java.lang.String"
column="LOCATION6"
length="4"
/>
<property
name="level4"
type="java.lang.String"
column="LEVEL4"
length="4"
/>
<property
name="location4"
type="java.lang.String"
column="LOCATION4"
length="4"
/>
<property
name="employeeNo"
type="java.lang.String"
column="EMPLOYEE_NO"
length="10"
/>
<property
name="status"
type="java.lang.String"
column="STATUS"
length="2"
/>
<property
name="comment"
type="java.lang.String"
column="COMMENT"
length="80"
/>
<property
name="employeeName"
type="java.lang.String"
column="EMPLOYEE_NAME"
length="30"
/>
<property
name="lastSequence"
type="java.lang.String"
column="LAST_SEQUENCE"
length="4"
/>
<property
name="absTimestamp"
type="java.lang.String"
column="ABS_TIMESTAMP"
length="14"
/>
<property
name="adsSubject3"
type="java.lang.String"
column="ADS_SUBJECT3"
length="10"
/>
<property
name="subjects"
type="java.lang.String"
column="SUBJECTS"
length="80"
/>
<property
name="endDate"
type="java.lang.String"
column="END_DATE"
length="8"
/>
<property
name="absCreator"
type="java.lang.String"
column="ABS_CREATOR"
length="20"
/>
<property
name="totalHours"
type="java.math.BigDecimal"
column="TOTAL_HOURS"
length="10"
/>
<property
name="adsSubject4"
type="java.lang.String"
column="ADS_SUBJECT4"
length="10"
/>
<property
name="absenceType"
type="java.lang.String"
column="ABSENCE_TYPE"
length="4"
/>
<property
name="adsSubject5"
type="java.lang.String"
column="ADS_SUBJECT5"
length="10"
/>
<property
name="defStartTime"
type="java.lang.String"
column="DEF_START_TIME"
length="5"
/>
<property
name="location3"
type="java.lang.String"
column="LOCATION3"
length="4"
/>
<property
name="partDay"
type="java.lang.String"
column="PART_DAY"
length="7"
/>
<property
name="defHours"
type="java.math.BigDecimal"
column="DEF_HOURS"
length="10"
/>
<property
name="adsSubject2"
type="java.lang.String"
column="ADS_SUBJECT2"
length="10"
/>
<property
name="status1"
type="java.lang.String"
column="STATUS1"
length="2"
/>
<property
name="tentativeYn"
type="java.lang.String"
column="TENTATIVE_YN"
length="1"
/>
<property
name="scheduleDetail"
type="java.lang.String"
column="SCHEDULE_DETAIL"
length="805"
/>
<property
name="totalUnits"
type="java.math.BigDecimal"
column="TOTAL_UNITS"
length="10"
/>
<property
name="level5"
type="java.lang.String"
column="LEVEL5"
length="4"
/>
<property
name="defEndTime"
type="java.lang.String"
column="DEF_END_TIME"
length="5"
/>
<property
name="needReplacement"
type="java.lang.String"
column="NEED_REPLACEMENT"
length="1"
/>
<property
name="level3"
type="java.lang.String"
column="LEVEL3"
length="4"
/>
<property
name="startDate"
type="java.lang.String"
column="START_DATE"
length="8"
/>
<property
name="location1"
type="java.lang.String"
column="LOCATION1"
length="4"
/>
<!-- bi-directional one-to-many association to PrmAbsenceDetail -->
<bag
name="prmAbsenceDetails"
lazy="true"
inverse="true"
cascade="all-delete-orphan"
>
<key>
<column name="ABSENCE_ID" />
<column name="SEQUENCE" />
</key>
<one-to-many
class="com.*.model.legacy.PrmAbsenceDetail"
/>
</bag>

</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd" >
<hibernate-mapping>

<class
name="com.*.model.legacy.PrmAbsenceDetail"
table="ABSENCE_DETAIL"
lazy="true"
>
<composite-id>
<key-property
name="absenceId"
type="java.lang.String"
length="14"
column="ABSENCE_ID"/>
<key-property
name="sequence"
type="java.lang.String"
length="4"
column="SEQUENCE"/>
</composite-id>
<property
name="leaveId"
type="java.lang.String"
column="LEAVE_ID"
length="14"
/>
<property
name="hourAmt"
type="java.math.BigDecimal"
column="HOUR_AMT"
length="10"
/>
<property
name="opsGl"
type="java.lang.String"
column="OPS_GL"
length="30"
/>
<property
name="flIdNo"
type="java.lang.String"
column="FL_ID_NO"
length="10"
/>
<property
name="flNo"
type="java.lang.String"
column="FL_NO"
length="1"
/>
<property
name="hrsOrFte"
type="java.lang.String"
column="HRS_OR_FTE"
length="1"
/>
<property
name="amendmentStat"
type="java.lang.String"
column="AMENDMENT_STAT"
length="2"
/>
<property
name="unitType"
type="java.lang.String"
column="UNIT_TYPE"
length="1"
/>
<property
name="location"
type="java.lang.String"
column="LOCATION"
length="4"
/>
<property
name="absenceCode"
type="java.lang.String"
column="ABSENCE_CODE"
length="4"
/>
<property
name="absenceDate"
type="java.lang.String"
column="ABSENCE_DATE"
length="8"
/>
<property
name="flDistNo"
type="java.lang.String"
column="FL_DIST_NO"
length="2"
/>
<property
name="interfaceSeq"
type="java.lang.String"
column="INTERFACE_SEQ"
length="4"
/>
<property
name="employeeNo"
type="java.lang.String"
column="EMPLOYEE_NO"
length="10"
/>
<property
name="status"
type="java.lang.String"
column="STATUS"
length="2"
/>
<property
name="startTime"
type="java.lang.String"
column="START_TIME"
length="5"
/>
<property
name="amOrPm"
type="java.lang.String"
column="AM_OR_PM"
length="1"
/>
<property
name="amendmentRule"
type="java.lang.String"
column="AMENDMENT_RULE"
length="4"
/>
<property
name="weekEndDate"
type="java.lang.String"
column="WEEK_END_DATE"
length="8"
/>
<property
name="amendmentSeq"
type="java.lang.String"
column="AMENDMENT_SEQ"
length="4"
/>
<property
name="realHours"
type="java.lang.String"
column="REAL_HOURS"
length="12"
/>
<property
name="dayCount"
type="java.math.BigDecimal"
column="DAY_COUNT"
length="10"
/>
<property
name="unitAmt"
type="java.math.BigDecimal"
column="UNIT_AMT"
length="10"
/>
<property
name="occupationCode"
type="java.lang.String"
column="OCCUPATION_CODE"
length="4"
/>
<property
name="payRate"
type="java.math.BigDecimal"
column="PAY_RATE"
length="10"
/>
<property
name="leaveUnits"
type="java.math.BigDecimal"
column="LEAVE_UNITS"
length="10"
/>
<property
name="opsHoursAmt"
type="java.math.BigDecimal"
column="OPS_HOURS_AMT"
length="10"
/>
<property
name="batchNo"
type="java.lang.String"
column="BATCH_NO"
length="15"
/>
<property
name="dayAmt"
type="java.math.BigDecimal"
column="DAY_AMT"
length="10"
/>
<property
name="hoursPerDay"
type="java.math.BigDecimal"
column="HOURS_PER_DAY"
length="10"
/>
<property
name="payCode"
type="java.lang.String"
column="PAY_CODE"
length="2"
/>
<property
name="status1"
type="java.lang.String"
column="STATUS1"
length="2"
/>
<property
name="absencePosition"
type="java.lang.String"
column="ABSENCE_POSITION"
length="8"
/>
<property
name="payrollId"
type="java.lang.String"
column="PAYROLL_ID"
length="4"
/>
<property
name="shiftCode"
type="java.lang.String"
column="SHIFT_CODE"
length="1"
/>
<property
name="interfaceSrc"
type="java.lang.String"
column="INTERFACE_SRC"
length="1"
/>
<property
name="endTime"
type="java.lang.String"
column="END_TIME"
length="5"
/>
<property
name="costCenter"
type="java.lang.String"
column="COST_CENTER"
length="10"
/>
<property
name="interfaceStat"
type="java.lang.String"
column="INTERFACE_STAT"
length="1"
/>
<property
name="flOrderNo"
type="java.lang.String"
column="FL_ORDER_NO"
length="2"
/>
<!-- associations -->
<!-- bi-directional many-to-one association to PrmAbsenceMaster -->
<many-to-one
name="prmAbsenceMaster"
class="com.*.model.legacy.PrmAbsenceMaster"
not-null="true" insert="false" update="false"
>
<column name="ABSENCE_ID" />
</many-to-one>

</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:
net.sf.hibernate.MappingException: collection foreign key mapping has wrong number of columns: com.*.model.legacy.PrmAbsenceMaster.prmAbsenceDetails type: string
at net.sf.hibernate.mapping.Collection.validate(Collection.java:248)
at net.sf.hibernate.cfg.Configuration.validate(Configuration.java:621)
at net.sf.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:785)
at com.*.app.TSCContext.setupFactories(TSCContext.java:112)
at com.*.app.TSCContext.setCurrentHttpServletRequest(TSCContext.java:86)
at com.*.app.ApplicationFilter.doFilter(ApplicationFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at edu.yale.its.tp.cas.client.filter.CASFilter.doFilter(CASFilter.java:401)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:534)


Top
 Profile  
 
 Post subject: collection foreign key mapping has wrong number of columns
PostPosted: Sat Nov 13, 2004 10:34 pm 
Newbie

Joined: Sun Aug 08, 2004 11:04 pm
Posts: 5
I found the problem:

<key>
<column name="ABSENCE_ID" />
<column name="SEQUENCE" />
</key>

should be

<key>
<column name="ABSENCE_ID" />
</key>


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.