Here is the error I am getting when attempting to create a sesion:
Quote:
Foreign key must have same number of columns as referenced primary key
How can I make the mapping file below will not generate the above error?
I am running against a MSSql Server 2000 DB.
Below is the mapping file that generates the error:
<?xml version="1.0" encoding="UTF-8"?>
<!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.ge.med.registries.cx1.TCx1ParticipantM" table="T_CX1_Participant_M">
<id column="Participant_ID" name="id" type="java.lang.Long">
<generator class="native"/>
</id>
<property column="ParticipantName" length="100" name="participantname" type="java.lang.String"/>
<property column="ZipPassword" length="50" name="zippassword" type="java.lang.String"/>
<property column="RegistryType" length="50" name="registrytype" type="java.lang.String"/>
<property column="Site_ID" length="10" name="siteId" type="java.lang.Integer"/>
</class>
<class name="com.ge.med.registries.cx1.TCx1PatientT" table="T_CX1_Patient_T">
<id column="PatID" name="id" type="java.lang.Long">
<generator class="native"/>
</id>
<property column="PatFName" length="50" name="patfname" type="java.lang.String"/>
<property column="PatMInit" length="1" name="patminit" type="java.lang.String"/>
<property column="PatLName" length="50" name="patlname" type="java.lang.String"/>
<property column="SSN" length="50" name="ssn" type="java.lang.String"/>
<property column="Gender" length="3" name="gender" type="java.lang.String"/>
<property column="DOB" length="23" name="dob" type="java.util.Date"/>
<property column="PhoneNumber" length="50" name="phonenumber" type="java.lang.String"/>
<property column="Address" length="100" name="address" type="java.lang.String"/>
<property column="City" length="50" name="city" type="java.lang.String"/>
<property column="State" length="50" name="state" type="java.lang.String"/>
<property column="Zip" length="50" name="zip" type="java.lang.String"/>
</class>
<!-- class com.gems.test.TCx1PatientT is maped 1 to 1 with com.gems.test.TA3PatientT -->
<class name="com.ge.med.registries.cx1.TCx1AdmdisT" table="T_CX1_AdmDis_T">
<composite-id>
<key-property column="Admission_ID" length="10" name="admissionId" type="java.lang.Integer"/>
<key-property column="Participant_ID" length="50" name="participantId" type="java.lang.String"/>
<key-property column="PatID" length="10" name="patid" type="java.lang.Integer"/>
</composite-id>
<property column="AdmitDt" length="23" name="admitdt" type="java.util.Date"/>
<property column="DischDt" length="23" name="dischdt" type="java.util.Date"/>
</class>
<!-- class com.gems.test.TCx1AdmdisT is maped 1 to 1 with com.gems.test.TA3AdmdisT -->
<class name="com.ge.med.registries.a31.TA3AdmdisT" table="T_A3_AdmDis_T">
<composite-id>
<key-property column="Admission_ID" length="10" name="admissionId" type="java.lang.Integer"/>
<key-property column="Participant_ID" length="50" name="participantId" type="java.lang.String"/>
<key-property column="PatID" length="10" name="patid" type="java.lang.Integer"/>
</composite-id>
<property column="AdmitSt" length="5" name="admitst" type="java.lang.Short"/>
<property column="Inpat" length="3" name="inpat" type="java.lang.String"/>
<property column="Payor" length="3" name="payor" type="java.lang.String"/>
<property column="Reserve1" length="10" name="reserve1" type="java.lang.String"/>
<property column="Reserve2" length="10" name="reserve2" type="java.lang.String"/>
<property column="Reserve3" length="10" name="reserve3" type="java.lang.String"/>
<property column="CABStat" length="3" name="cabstat" type="java.lang.String"/>
<property column="CABDt" length="16" name="cabdt" type="java.util.Date"/>
<property column="PstEnzCo" length="3" name="pstenzco" type="java.lang.String"/>
<property column="CKPrBAss" length="3" name="ckprbass" type="java.lang.String"/>
<property column="CKPrBase" length="5" name="ckprbase" type="java.lang.Short"/>
<property column="CKPsPAss" length="3" name="ckpspass" type="java.lang.String"/>
<property column="CKPsPeak" length="5" name="ckpspeak" type="java.lang.Short"/>
<property column="TPrBAss" length="3" name="tprbass" type="java.lang.String"/>
<property column="TPrBase" length="5" name="tprbase" type="java.lang.Short"/>
<property column="TPrPAss" length="3" name="tprpass" type="java.lang.String"/>
<property column="TPsPeak" length="5" name="tpspeak" type="java.lang.Short"/>
<property column="PsCreAss" length="3" name="pscreass" type="java.lang.String"/>
<property column="PsCreLev" length="53" name="pscrelev" type="java.lang.Float"/>
<property column="Blood" length="3" name="blood" type="java.lang.String"/>
<property column="SmoCess" length="3" name="smocess" type="java.lang.String"/>
<property column="CardRef" length="3" name="cardref" type="java.lang.String"/>
<property column="MtDCStat" length="3" name="mtdcstat" type="java.lang.String"/>
<property column="DisLoctn" length="5" name="disloctn" type="java.lang.Short"/>
<property column="MtDate" length="16" name="mtdate" type="java.util.Date"/>
<property column="MtCause" length="5" name="mtcause" type="java.lang.Short"/>
<property column="DeathLab" length="3" name="deathlab" type="java.lang.String"/>
<property column="COMPLETE" length="1" name="complete" type="java.lang.String"/>
<property column="SENT" length="1" name="sent" type="java.lang.String"/>
<one-to-one name="coreAdmit" class="com.ge.med.registries.cx1.TCx1AdmdisT" constrained="true" outer-join="false"/>
<many-to-one name="patientRef" class="com.ge.med.registries.a31.TA3PatientT" column="PatID" not-null="true"/>
</class>
<class name="com.ge.med.registries.a31.TA3PatientT" table="T_A3_Patient_T">
<composite-id>
<key-property column="PatID" length="10" name="patid" type="java.lang.Integer"/>
<key-property column="Participant_ID" length="50" name="participantId" type="java.lang.String"/>
</composite-id>
<property column="Race" length="5" name="race" type="java.lang.Short"/>
<one-to-one name="corePatient" class="com.ge.med.registries.cx1.TCx1PatientT" constrained="true" outer-join="false"/>
<bag name="admits" inverse="true" lazy="true" cascade="all">
<key column="PatID"/>
<one-to-many class="com.ge.med.registries.a31.TA3AdmdisT"/>
</bag>
</class>
</hibernate-mapping>
[/code]