-->
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.  [ 1 post ] 
Author Message
 Post subject: Difficulty with mapping many-to-one
PostPosted: Mon Oct 24, 2005 7:01 pm 
Regular
Regular

Joined: Thu Aug 19, 2004 9:28 am
Posts: 63
Hi,

I'm not sure if this is a bug or I just don't map my association right.

I'm trying to map 5 columns from table 1 (personExpertise) to table 2 (discipline). The 5 columns basically contain a code and I go get the code's description in the second table.

For some reasons the generated SQL comes out with way to many columns and that has for effect to generate the duplicate Alias name for some columns. I must be doing something wrong but I can't figure out what it is.

Thanks for your help.



Take a look at the HQL and the resulting SQL.

HQL:
select new ca.sshrc.web.forms.beans.cv.ExpertiseBean(form.formId, PersonExpertise.cid,
PersonExpertise.disciplineCode1,
Discipline_a.nameEnglish,
PersonExpertise.disciplineCode2,
Discipline_b.nameEnglish,
PersonExpertise.disciplineCode3,
Discipline_c.nameEnglish,
PersonExpertise.disciplineCode4,
Discipline_d.nameEnglish,
PersonExpertise.disciplineCode5,
Discipline_e.nameEnglish)
from hibernate.Form form join form.person as Person
left join fetch Person.personExpertise as PersonExpertise
left join fetch PersonExpertise.disciplineCode1 as Discipline_a
left join fetch PersonExpertise.disciplineCode2 as Discipline_b
left join fetch PersonExpertise.disciplineCode3 as Discipline_c
left join fetch PersonExpertise.disciplineCode4 as Discipline_d
left join fetch PersonExpertise.disciplineCode5 as Discipline_e
where (form.formId = :formId)


SQL:
select form0_.Form_ID as col_0_0_, personexpe2_.CID as col_1_0_, personexpe2_.Discipline_Code_1 as col_2_0_, discipline3_.Name_English as col_3_0_, personexpe2_.Discipline_Code_2 as col_4_0_, discipline4_.Name_English as col_5_0_, personexpe2_.Discipline_Code_3 as col_6_0_, discipline5_.Name_English as col_7_0_, personexpe2_.Discipline_Code_4 as col_8_0_, discipline6_.Name_English as col_9_0_, personexpe2_.Discipline_Code_5 as col_10_0_, discipline7_.Name_English as col_11_0_, personexpe2_.CID as CID54_2_, discipline3_.Discipline_Code as Discipline1_33_3_, discipline4_.Discipline_Code as Discipline1_33_4_, discipline5_.Discipline_Code as Discipline1_33_5_, discipline6_.Discipline_Code as Discipline1_33_6_, discipline7_.Discipline_Code as Discipline1_33_7_, personexpe2_.CID as CID54_0_, discipline3_.Discipline_Code as Discipline1_33_1_, discipline4_.Discipline_Code as Discipline1_33_2_, discipline5_.Discipline_Code as Discipline1_33_3_, discipline6_.Discipline_Code as Discipline1_33_4_, discipline7_.Discipline_Code as Discipline1_33_5_, personexpe2_.Keywords as Keywords54_0_, personexpe2_.Other_Discipline_Name_1 as Other3_54_0_, personexpe2_.Other_Discipline_Name_2 as Other4_54_0_, personexpe2_.Other_Discipline_Name_3 as Other5_54_0_, personexpe2_.Other_Discipline_Name_4 as Other6_54_0_, personexpe2_.Other_Discipline_Name_5 as Other7_54_0_, personexpe2_.Temporal_Start_Year_1 as Temporal8_54_0_, personexpe2_.Temporal_Start_BC_AD_1 as Temporal9_54_0_, personexpe2_.Temporal_End_Year_1 as Temporal10_54_0_, personexpe2_.Temporal_End_BC_AD_1 as Temporal11_54_0_, personexpe2_.Temporal_Start_Year_2 as Temporal12_54_0_, personexpe2_.Temporal_Start_BC_AD_2 as Temporal13_54_0_, personexpe2_.Temporal_End_Year_2 as Temporal14_54_0_, personexpe2_.Temporal_End_BC_AD_2 as Temporal15_54_0_, personexpe2_.Create_Date as Create16_54_0_, personexpe2_.Create_User_ID as Create17_54_0_, personexpe2_.Change_Date as Change18_54_0_, personexpe2_.Change_User_ID as Change19_54_0_, personexpe2_.Discipline_Code_1 as Discipline20_54_0_, personexpe2_.Discipline_Code_2 as Discipline21_54_0_, personexpe2_.Discipline_Code_3 as Discipline22_54_0_, personexpe2_.Discipline_Code_4 as Discipline23_54_0_, personexpe2_.Discipline_Code_5 as Discipline24_54_0_, personexpe2_.Area_Of_Research_Code_1 as Area25_54_0_, personexpe2_.Area_Of_Research_Code_2 as Area26_54_0_, personexpe2_.Area_Of_Research_Code_3 as Area27_54_0_, personexpe2_.GeoPolitical_Code_1 as GeoPoli28_54_0_, personexpe2_.GeoPolitical_Code_2 as GeoPoli29_54_0_, personexpe2_.GeoPolitical_Code_3 as GeoPoli30_54_0_, personexpe2_.Country_Code_1 as Country31_54_0_, personexpe2_.Province_State_Code_1 as Province32_54_0_, personexpe2_.Country_Code_2 as Country33_54_0_, personexpe2_.Province_State_Code_2 as Province34_54_0_, personexpe2_.Country_Code_3 as Country35_54_0_, personexpe2_.Province_State_Code_3 as Province36_54_0_, personexpe2_.Country_Code_4 as Country37_54_0_, personexpe2_.Province_State_Code_4 as Province38_54_0_, personexpe2_.Country_Code_5 as Country39_54_0_, personexpe2_.Province_State_Code_5 as Province40_54_0_, personexpe2_.CID as CID0__, discipline3_.Name_French as Name2_33_1_, discipline3_.Name_English as Name3_33_1_, discipline3_.Active_Ind as Active4_33_1_, discipline3_.Create_Date as Create5_33_1_, discipline3_.Create_User_ID as Create6_33_1_, discipline3_.Change_Date as Change7_33_1_, discipline3_.Change_User_ID as Change8_33_1_, discipline3_.Main_Discipline_Code as Main9_33_1_, discipline4_.Name_French as Name2_33_2_, discipline4_.Name_English as Name3_33_2_, discipline4_.Active_Ind as Active4_33_2_, discipline4_.Create_Date as Create5_33_2_, discipline4_.Create_User_ID as Create6_33_2_, discipline4_.Change_Date as Change7_33_2_, discipline4_.Change_User_ID as Change8_33_2_, discipline4_.Main_Discipline_Code as Main9_33_2_, discipline5_.Name_French as Name2_33_3_, discipline5_.Name_English as Name3_33_3_, discipline5_.Active_Ind as Active4_33_3_, discipline5_.Create_Date as Create5_33_3_, discipline5_.Create_User_ID as Create6_33_3_, discipline5_.Change_Date as Change7_33_3_, discipline5_.Change_User_ID as Change8_33_3_, discipline5_.Main_Discipline_Code as Main9_33_3_, discipline6_.Name_French as Name2_33_4_, discipline6_.Name_English as Name3_33_4_, discipline6_.Active_Ind as Active4_33_4_, discipline6_.Create_Date as Create5_33_4_, discipline6_.Create_User_ID as Create6_33_4_, discipline6_.Change_Date as Change7_33_4_, discipline6_.Change_User_ID as Change8_33_4_, discipline6_.Main_Discipline_Code as Main9_33_4_, discipline7_.Name_French as Name2_33_5_, discipline7_.Name_English as Name3_33_5_, discipline7_.Active_Ind as Active4_33_5_, discipline7_.Create_Date as Create5_33_5_, discipline7_.Create_User_ID as Create6_33_5_, discipline7_.Change_Date as Change7_33_5_, discipline7_.Change_User_ID as Change8_33_5_, discipline7_.Main_Discipline_Code as Main9_33_5_ from FORMS form0_ inner join PERSON person1_ on form0_.CID=person1_.CID left outer join PERSON_EXPERTISE personexpe2_ on person1_.CID=personexpe2_.CID left outer join DISCIPLINE discipline3_ on personexpe2_.Discipline_Code_1=discipline3_.Discipline_Code left outer join DISCIPLINE discipline4_ on personexpe2_.Discipline_Code_2=discipline4_.Discipline_Code left outer join DISCIPLINE discipline5_ on personexpe2_.Discipline_Code_3=discipline5_.Discipline_Code left outer join DISCIPLINE discipline6_ on personexpe2_.Discipline_Code_4=discipline6_.Discipline_Code left outer join DISCIPLINE discipline7_ on personexpe2_.Discipline_Code_5=discipline7_.Discipline_Code where form0_.Form_ID=?


Hibernate version: 3.1 rc2

Mapping documents:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping default-lazy="true">
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
-->
<class name="hibernate.Form" table="FORMS" lazy="true">
<id name="formId" type="java.lang.Long" column="Form_ID" unsaved-value="null">
<generator class="native"/>
</id>
<property name="cid" type="java.lang.Integer" column="CID" not-null="true" length="6" insert="false" update="false"/>
<property name="formLanguage" type="java.lang.String" column="Form_Language" not-null="true" length="1"/>
<property name="formStatus" type="java.lang.String" column="Form_Status" not-null="true" length="1"/>
<property name="transferredToAmisDate" type="java.sql.Timestamp" column="Transferred_To_AMIS_Date" length="23"/>
<property name="transferredToAmisIndicator" type="java.lang.String" column="Transferred_To_AMIS_Indicator" length="1"/>
<property name="createUserId" type="java.lang.String" column="Create_User_ID" not-null="true" length="3" insert="false" update="false"/>
<property name="createDate" type="java.sql.Timestamp" column="Create_Date" not-null="true" length="23" insert="false" update="false"/>
<property name="changeUserId" type="java.lang.String" column="Change_User_ID" not-null="true" length="3" insert="false" update="false"/>
<property name="changeDate" type="java.util.Date" column="Change_Date" not-null="true" length="23" insert="false" update="false"/>
<!-- associations -->
<!-- bi-directional many-to-one association to Application -->
<many-to-one name="application" class="hibernate.Application" column="Appl_ID"></many-to-one>
<!-- bi-directional many-to-one association to WebSubsystem -->
<many-to-one name="webSubsystem" class="hibernate.WebSubsystem" not-null="true" column="Subsystem_ID"> </many-to-one>
<!-- <property name="cid" type="java.lang.Integer" column="CID" not-null="true" length="6"/> -->
<many-to-one name="person" class="hibernate.Person" column="CID"></many-to-one>
</class>
</hibernate-mapping>




<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping default-lazy="true">
<!--
Created by the Middlegen Hibernate plugin
http://boss.bekk.no/boss/middlegen/
http://hibernate.sourceforge.net/
<<<<<<< Person.hbm.xml
-->
<class name="hibernate.Person" table="PERSON" lazy="true">
<id name="cid" type="java.lang.Integer" column="CID">
<generator class="native"/>
</id>
<property name="amisCid" type="java.lang.Integer" column="Amis_CID" length="6"/>
<property name="familyName" type="java.lang.String" column="Family_Name" length="30"/>
<property name="givenName" type="java.lang.String" column="Given_Name" length="30"/>
<property name="initials" type="java.lang.String" column="Initials" length="4"/>
<property name="salutation" type="java.lang.Integer" column="Salutation" length="4"/>
<property name="yearOfBirth" type="java.lang.Short" column="Year_Of_Birth" length="5"/>
<property name="sin" type="java.lang.Integer" column="SIN" length="9"/>
<property name="sshrcEmployeeInd" type="java.lang.String" column="SSHRC_Employee_Ind" length="1"/>
<property name="personStatusCode" type="java.lang.Integer" column="Person_Status_Code" length="4"/>
<property name="statusChangeDate" type="java.sql.Timestamp" column="Status_Change_Date" length="23"/>
<property name="primaryMailAddrId" type="java.lang.Integer" column="Primary_Mail_Addr_ID" length="6"/>
<property name="primaryMailAddrPositionId" type="java.lang.Integer" column="Primary_Mail_Addr_Position_ID" length="6"/>
<property name="assessorInvitationInd" type="java.lang.String" column="Assessor_Invitation_Ind" length="1"/>
<property name="assessorWillingToServeInd" type="java.lang.String" column="Assessor_Willing_To_Serve_Ind" length="1"/>
<property name="assessorOrgId" type="java.lang.Integer" column="Assessor_Org_ID" length="8"/>
<property name="assessorNominatedBy" type="java.lang.String" column="Assessor_Nominated_By" length="40"/>
<property name="assessorNominatedDate" type="java.sql.Timestamp" column="Assessor_Nominated_Date" length="23"/>
<property name="assessorUnavailableFromDate" type="java.sql.Timestamp" column="Assessor_Unavailable_From_Date" length="23"/>
<property name="assessorUnavailableToDate" type="java.sql.Timestamp" column="Assessor_Unavailable_To_Date" length="23"/>
<property name="assessorRecommendationInd" type="java.lang.String" column="Assessor_Recommendation_Ind" length="1"/>
<property name="comInvitationForServiceInd" type="java.lang.String" column="Com_Invitation_For_Service_Ind" length="1"/>
<property name="comWillingToServeInd" type="java.lang.String" column="Com_Willing_To_Serve_Ind" length="1"/>
<property name="comUnavailableFromDate" type="java.sql.Timestamp" column="Com_Unavailable_From_Date" length="23"/>
<property name="comUnavailableToDate" type="java.sql.Timestamp" column="Com_Unavailable_To_Date" length="23"/>
<property name="comAppointedToId" type="java.lang.Integer" column="Com_Appointed_To_ID" length="5"/>
<property name="citizenshipType" type="java.lang.Integer" column="Citizenship_Type" length="4"/>
<property name="landedOnDate" type="java.sql.Timestamp" column="Landed_On_Date" length="23"/>
<property name="permResStatusInd" type="java.lang.String" column="Perm_Res_Status_Ind" length="1"/>
<property name="gender" type="java.lang.Integer" column="Gender" length="4"/>
<property name="correspondenceLanguageCode" type="java.lang.String" column="Correspondence_Language_Code" not-null="true" length="1"/>
<property name="readEnglish" type="java.lang.String" column="Read_English" not-null="true" length="1"/>
<property name="writeEnglish" type="java.lang.String" column="Write_English" length="1"/>
<property name="speakEnglish" type="java.lang.String" column="Speak_English" length="1"/>
<property name="auralEnglish" type="java.lang.String" column="Aural_English" length="1"/>
<property name="readFrench" type="java.lang.String" column="Read_French" length="1"/>
<property name="writeFrench" type="java.lang.String" column="Write_French" length="1"/>
<property name="speakFrench" type="java.lang.String" column="Speak_French" length="1"/>
<property name="auralFrench" type="java.lang.String" column="Aural_French" length="1"/>
<property name="otherLanguages" type="java.lang.String" column="Other_Languages" length="255"/>
<property name="cvUpdateDate" type="java.sql.Timestamp" column="CV_Update_Date" length="23"/>
<property name="cvKeywords" type="java.lang.String" column="CV_Keywords" length="255"/>
<property name="officerKeywords" type="java.lang.String" column="Officer_Keywords" length="255"/>
<property name="expertiseNote" type="java.lang.String" column="Expertise_Note" length="255"/>
<property name="includePeerReviewInd" type="java.lang.String" column="Include_Peer_Review_Ind" length="1"/>
<property name="phoneCountryCode" type="java.lang.String" column="Phone_Country_Code" length="3"/>
<property name="phoneAreaCode" type="java.lang.String" column="Phone_Area_Code" length="4"/>
<property name="phoneNumber" type="java.lang.String" column="Phone_Number" length="12"/>
<property name="phoneExtension" type="java.lang.String" column="Phone_Extension" length="5"/>
<property name="tmpPhoneCountryCode" type="java.lang.String" column="TMP_Phone_Country_Code" length="3"/>
<property name="tmpPhoneAreaCode" type="java.lang.String" column="TMP_Phone_Area_Code" length="4"/>
<property name="tmpPhoneNumber" type="java.lang.String" column="TMP_Phone_Number" length="12"/>
<property name="tmpPhoneExtension" type="java.lang.String" column="TMP_Phone_Extension" length="5"/>
<property name="secPhoneCountryCode" type="java.lang.String" column="Sec_Phone_Country_Code" length="3"/>
<property name="secPhoneAreaCode" type="java.lang.String" column="Sec_Phone_Area_Code" length="4"/>
<property name="secPhoneNumber" type="java.lang.String" column="Sec_Phone_Number" length="12"/>
<property name="secPhoneExtension" type="java.lang.String" column="Sec_Phone_Extension" length="5"/>
<property name="faxPhoneCountryCode" type="java.lang.String" column="FAX_Phone_Country_Code" length="3"/>
<property name="faxAreaCode" type="java.lang.String" column="FAX_Area_Code" length="4"/>
<property name="faxNumber" type="java.lang.String" column="FAX_Number" length="12"/>
<property name="faxPhoneExtension" type="java.lang.String" column="FAX_Phone_Extension" length="5"/>
<property name="tmpFaxCountryCode" type="java.lang.String" column="TMP_FAX_Country_Code" length="3"/>
<property name="tmpFaxPhoneAreaCode" type="java.lang.String" column="TMP_FAX_Phone_Area_Code" length="4"/>
<property name="tmpFaxPhoneNumber" type="java.lang.String" column="TMP_FAX_Phone_Number" length="12"/>
<property name="tmpFaxPhoneExtension" type="java.lang.String" column="TMP_FAX_Phone_Extension" length="5"/>
<property name="secFaxCountryCode" type="java.lang.String" column="Sec_Fax_Country_Code" length="3"/>
<property name="secFaxAreaCode" type="java.lang.String" column="Sec_Fax_Area_Code" length="4"/>
<property name="secFaxNumber" type="java.lang.String" column="Sec_Fax_Number" length="12"/>
<property name="secFaxExtension" type="java.lang.String" column="Sec_Fax_Extension" length="5"/>
<property name="emailAddress" type="java.lang.String" column="EMail_Address" length="100"/>
<property name="tmpEmailAddress" type="java.lang.String" column="TMP_EMail_Address" length="100"/>
<property name="scndEmailAddress" type="java.lang.String" column="Scnd_EMail_Address" length="100"/>
<property name="allTmpControlDateFrom" type="java.sql.Timestamp" column="All_TMP_Control_Date_From" length="23"/>
<property name="allTmpControlDateTo" type="java.sql.Timestamp" column="All_TMP_Control_Date_To" length="23"/>
<property name="createUserId" type="java.lang.String" column="Create_User_ID" not-null="true" length="3" insert="false" update="false"/>
<property name="createDate" type="java.sql.Timestamp" column="Create_Date" not-null="true" length="23" insert="false" update="false"/>
<property name="changeUserId" type="java.lang.String" column="Change_User_ID" not-null="true" length="3" insert="false" update="false"/>
<property name="changeDate" type="java.util.Date" column="Change_Date" not-null="true" length="23" insert="false" update="false"/>
<property name="newPersonInd" type="java.lang.String" column="New_Person_Ind" length="1"/>
<property name="alias" type="java.lang.String" column="Alias" length="100"/>
<property name="personConsentInd" type="java.lang.String" column="Person_Consent_Ind" length="1"/>
<property name="transferredToAmisInd" type="java.lang.String" column="Transferred_To_AMIS_Ind" length="1"/>
<property name="transferredDate" type="java.sql.Timestamp" column="Transferred_Date" length="23"/>
<property name="postalCode" type="java.lang.String" column="Postal_Code" length="6"/>
<property name="formStatus" type="java.lang.String" column="Form_Status" length="1"/>
<property name="formLanguage" type="java.lang.String" column="Form_Language" length="1"/>
<property name="landedYear" type="java.lang.String" column="Landed_Year" length="4"/>
<property name="landedMonth" type="java.lang.String" column="Landed_Month" length="2"/>
<property name="landedDay" type="java.lang.String" column="Landed_Day" length="2"/>
<property name="lastAccessDate" type="java.sql.Timestamp" column="Last_Access_Date" length="23"/>
<property name="previousFamilyName" type="java.lang.String" column="Previous_family_name" length="30"/>
<!-- associations -->
<!-- <property name="otherCountryCode" type="java.lang.Integer" column="Other_Country_Code" length="5"/> -->
<many-to-one name="otherCountryCode" class="hibernate.Country" column="Other_Country_Code"> </many-to-one>
<!-- unidirectional one-to-many association to personPosition -->
<set name="personPosition">
<key column="CID"> </key>
<one-to-many class="hibernate.PersonPosition"/>
</set>
<!-- unidirectional one-to-many association to personAddress -->
<set name="personAddress">
<key column="CID"> </key>
<one-to-many class="hibernate.PersonAddress"/>
</set>
<!-- unidirectional one-to-many association to personAcademicBackground -->
<set name="personAcademicBackground">
<key column="CID"> </key>
<one-to-many class="hibernate.PersonAcademicBackground"/>
</set>
<!-- unidirectional one-to-many association to PersonExpertise -->
<set name="personExpertise">
<key column="CID"> </key>
<one-to-many class="hibernate.PersonExpertise"/>
</set>
<!-- unidirectional one-to-many association to personResearchSupport -->
<set name="personResearchSupport">
<key column="CID"> </key>
<one-to-many class="hibernate.PersonResearchSupport"/>
</set>
</class>
</hibernate-mapping>





<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="hibernate.PersonExpertise" table="PERSON_EXPERTISE" lazy="true">
<id name="cid" type="java.lang.Integer" column="CID">
<generator class="assigned"/>
</id>
<property name="keywords" type="java.lang.String" column="Keywords" length="255"/>
<property name="otherDisciplineName1" type="java.lang.String" column="Other_Discipline_Name_1" length="40"/>
<property name="otherDisciplineName2" type="java.lang.String" column="Other_Discipline_Name_2" length="40"/>
<property name="otherDisciplineName3" type="java.lang.String" column="Other_Discipline_Name_3" length="40"/>
<property name="otherDisciplineName4" type="java.lang.String" column="Other_Discipline_Name_4" length="40"/>
<property name="otherDisciplineName5" type="java.lang.String" column="Other_Discipline_Name_5" length="40"/>
<property name="temporalStartYear1" type="java.lang.Integer" column="Temporal_Start_Year_1" length="10"/>
<property name="temporalStartBcAd1" type="java.lang.String" column="Temporal_Start_BC_AD_1" length="2"/>
<property name="temporalEndYear1" type="java.lang.Integer" column="Temporal_End_Year_1" length="10"/>
<property name="temporalEndBcAd1" type="java.lang.String" column="Temporal_End_BC_AD_1" length="2"/>
<property name="temporalStartYear2" type="java.lang.Integer" column="Temporal_Start_Year_2" length="10"/>
<property name="temporalStartBcAd2" type="java.lang.String" column="Temporal_Start_BC_AD_2" length="2"/>
<property name="temporalEndYear2" type="java.lang.Integer" column="Temporal_End_Year_2" length="10"/>
<property name="temporalEndBcAd2" type="java.lang.String" column="Temporal_End_BC_AD_2" length="2"/>
<property name="createDate" type="java.sql.Timestamp" column="Create_Date" length="23" insert="false" update="false"/>
<property name="createUserId" type="java.lang.String" column="Create_User_ID" length="3" insert="false" update="false"/>
<property name="changeDate" type="java.util.Date" column="Change_Date" length="23" insert="false" update="false"/>
<property name="changeUserId" type="java.lang.String" column="Change_User_ID" length="3" insert="false" update="false"/>
<!-- associations -->
<!-- <property name="disciplineCode1" type="java.lang.Integer" column="Discipline_Code_1" length="5"/> -->
<many-to-one name="disciplineCode1" class="hibernate.Discipline" update="false" insert="false">
<column name="Discipline_Code_1"/>
</many-to-one>
<!-- <property name="disciplineCode2" type="java.lang.Integer" column="Discipline_Code_2" length="5"/> -->
<many-to-one name="disciplineCode2" class="hibernate.Discipline" update="false" insert="false">
<column name="Discipline_Code_2"/>
</many-to-one>
<!-- <property name="disciplineCode3" type="java.lang.Integer" column="Discipline_Code_3" length="5"/> -->
<many-to-one name="disciplineCode3" class="hibernate.Discipline" update="false" insert="false">
<column name="Discipline_Code_3"/>
</many-to-one>
<!-- <property name="disciplineCode4" type="java.lang.Integer" column="Discipline_Code_4" length="5"/> -->
<many-to-one name="disciplineCode4" class="hibernate.Discipline" update="false" insert="false">
<column name="Discipline_Code_4"/>
</many-to-one>
<!-- <property name="disciplineCode5" type="java.lang.Integer" column="Discipline_Code_5" length="5"/> -->
<many-to-one name="disciplineCode5" class="hibernate.Discipline" update="false" insert="false">
<column name="Discipline_Code_5"/>
</many-to-one>
<!-- <property name="areaOfResearchCode1" type="java.lang.Integer" column="Area_Of_Research_Code_1" length="4"/> -->
<many-to-one name="areaOfResearchCode1" class="hibernate.Cod" column="Area_Of_Research_Code_1" update="false" insert="false"> </many-to-one>
<!-- <property name="areaOfResearchCode2" type="java.lang.Integer" column="Area_Of_Research_Code_2" length="4"/> -->
<many-to-one name="areaOfResearchCode2" class="hibernate.Cod" column="Area_Of_Research_Code_2" update="false" insert="false"> </many-to-one>
<!-- <property name="areaOfResearchCode3" type="java.lang.Integer" column="Area_Of_Research_Code_3" length="4"/> -->
<many-to-one name="areaOfResearchCode3" class="hibernate.Cod" column="Area_Of_Research_Code_3" update="false" insert="false"> </many-to-one>
<!-- <property name="geoPoliticalCode1" type="java.lang.Integer" column="GeoPolitical_Code_1" length="4"/> -->
<many-to-one name="geoPoliticalCode1" class="hibernate.Cod" column="GeoPolitical_Code_1" update="false" insert="false"> </many-to-one>
<!-- <property name="geoPoliticalCode2" type="java.lang.Integer" column="GeoPolitical_Code_2" length="4"/> -->
<many-to-one name="geoPoliticalCode2" class="hibernate.Cod" column="GeoPolitical_Code_2" update="false" insert="false"> </many-to-one>
<!-- <property name="geoPoliticalCode3" type="java.lang.Integer" column="GeoPolitical_Code_3" length="4"/> -->
<many-to-one name="geoPoliticalCode3" class="hibernate.Cod" column="GeoPolitical_Code_3" update="false" insert="false"> </many-to-one>
<!-- <property name="countryCode1" type="java.lang.Integer" column="Country_Code_1" length="5"/> -->
<many-to-one name="countryCode1" class="hibernate.Country" column="Country_Code_1" update="false" insert="false"> </many-to-one>
<!-- <property name="provinceStateCode1" type="java.lang.String" column="Province_State_Code_1" length="2"/> -->
<many-to-one name="provinceStateCode1" class="hibernate.ProvinceState" column="Province_State_Code_1" update="false" insert="false"> </many-to-one>
<!-- <property name="countryCode2" type="java.lang.Integer" column="Country_Code_2" length="5"/> -->
<many-to-one name="countryCode2" class="hibernate.Country" column="Country_Code_2" update="false" insert="false"> </many-to-one>
<!-- <property name="provinceStateCode2" type="java.lang.String" column="Province_State_Code_2" length="2"/> -->
<many-to-one name="provinceStateCode2" class="hibernate.ProvinceState" column="Province_State_Code_2" update="false" insert="false"> </many-to-one>
<!-- <property name="countryCode3" type="java.lang.Integer" column="Country_Code_3" length="5"/> -->
<many-to-one name="countryCode3" class="hibernate.Country" column="Country_Code_3" update="false" insert="false"> </many-to-one>
<!-- <property name="provinceStateCode3" type="java.lang.String" column="Province_State_Code_3" length="2"/> -->
<many-to-one name="provinceStateCode3" class="hibernate.ProvinceState" column="Province_State_Code_3" update="false" insert="false"> </many-to-one>
<!-- <property name="countryCode4" type="java.lang.Integer" column="Country_Code_4" length="5"/> -->
<many-to-one name="countryCode4" class="hibernate.Country" column="Country_Code_4" update="false" insert="false"> </many-to-one>
<!-- <property name="provinceStateCode4" type="java.lang.String" column="Province_State_Code_4" length="2"/> -->
<many-to-one name="provinceStateCode4" class="hibernate.ProvinceState" column="Province_State_Code_4" update="false" insert="false"> </many-to-one>
<!-- <property name="countryCode5" type="java.lang.Integer" column="Country_Code_5" length="5"/> -->
<many-to-one name="countryCode5" class="hibernate.Country" column="Country_Code_5" update="false" insert="false"> </many-to-one>
<!-- <property name="provinceStateCode5" type="java.lang.String" column="Province_State_Code_5" length="2"/> -->
<many-to-one name="provinceStateCode5" class="hibernate.ProvinceState" column="Province_State_Code_5" update="false" insert="false"> </many-to-one>
</class>
</hibernate-mapping>

Full stack trace of any exception that occurs:
DEBUG [main] (JDBCExceptionReporter.java:63) - could not execute query [select form0_.Form_ID as col_0_0_, personexpe2_.CID as col_1_0_, personexpe2_.Discipline_Code_1 as col_2_0_, discipline3_.Name_English as col_3_0_, personexpe2_.Discipline_Code_2 as col_4_0_, discipline4_.Name_English as col_5_0_, personexpe2_.Discipline_Code_3 as col_6_0_, discipline5_.Name_English as col_7_0_, personexpe2_.Discipline_Code_4 as col_8_0_, discipline6_.Name_English as col_9_0_, personexpe2_.Discipline_Code_5 as col_10_0_, discipline7_.Name_English as col_11_0_, personexpe2_.CID as CID54_2_, discipline3_.Discipline_Code as Discipline1_33_3_, discipline4_.Discipline_Code as Discipline1_33_4_, discipline5_.Discipline_Code as Discipline1_33_5_, discipline6_.Discipline_Code as Discipline1_33_6_, discipline7_.Discipline_Code as Discipline1_33_7_, personexpe2_.CID as CID54_0_, discipline3_.Discipline_Code as Discipline1_33_1_, discipline4_.Discipline_Code as Discipline1_33_2_, discipline5_.Discipline_Code as Discipline1_33_3_, discipline6_.Discipline_Code as Discipline1_33_4_, discipline7_.Discipline_Code as Discipline1_33_5_, personexpe2_.Keywords as Keywords54_0_, personexpe2_.Other_Discipline_Name_1 as Other3_54_0_, personexpe2_.Other_Discipline_Name_2 as Other4_54_0_, personexpe2_.Other_Discipline_Name_3 as Other5_54_0_, personexpe2_.Other_Discipline_Name_4 as Other6_54_0_, personexpe2_.Other_Discipline_Name_5 as Other7_54_0_, personexpe2_.Temporal_Start_Year_1 as Temporal8_54_0_, personexpe2_.Temporal_Start_BC_AD_1 as Temporal9_54_0_, personexpe2_.Temporal_End_Year_1 as Temporal10_54_0_, personexpe2_.Temporal_End_BC_AD_1 as Temporal11_54_0_, personexpe2_.Temporal_Start_Year_2 as Temporal12_54_0_, personexpe2_.Temporal_Start_BC_AD_2 as Temporal13_54_0_, personexpe2_.Temporal_End_Year_2 as Temporal14_54_0_, personexpe2_.Temporal_End_BC_AD_2 as Temporal15_54_0_, personexpe2_.Create_Date as Create16_54_0_, personexpe2_.Create_User_ID as Create17_54_0_, personexpe2_.Change_Date as Change18_54_0_, personexpe2_.Change_User_ID as Change19_54_0_, personexpe2_.Discipline_Code_1 as Discipline20_54_0_, personexpe2_.Discipline_Code_2 as Discipline21_54_0_, personexpe2_.Discipline_Code_3 as Discipline22_54_0_, personexpe2_.Discipline_Code_4 as Discipline23_54_0_, personexpe2_.Discipline_Code_5 as Discipline24_54_0_, personexpe2_.Area_Of_Research_Code_1 as Area25_54_0_, personexpe2_.Area_Of_Research_Code_2 as Area26_54_0_, personexpe2_.Area_Of_Research_Code_3 as Area27_54_0_, personexpe2_.GeoPolitical_Code_1 as GeoPoli28_54_0_, personexpe2_.GeoPolitical_Code_2 as GeoPoli29_54_0_, personexpe2_.GeoPolitical_Code_3 as GeoPoli30_54_0_, personexpe2_.Country_Code_1 as Country31_54_0_, personexpe2_.Province_State_Code_1 as Province32_54_0_, personexpe2_.Country_Code_2 as Country33_54_0_, personexpe2_.Province_State_Code_2 as Province34_54_0_, personexpe2_.Country_Code_3 as Country35_54_0_, personexpe2_.Province_State_Code_3 as Province36_54_0_, personexpe2_.Country_Code_4 as Country37_54_0_, personexpe2_.Province_State_Code_4 as Province38_54_0_, personexpe2_.Country_Code_5 as Country39_54_0_, personexpe2_.Province_State_Code_5 as Province40_54_0_, personexpe2_.CID as CID0__, discipline3_.Name_French as Name2_33_1_, discipline3_.Name_English as Name3_33_1_, discipline3_.Active_Ind as Active4_33_1_, discipline3_.Create_Date as Create5_33_1_, discipline3_.Create_User_ID as Create6_33_1_, discipline3_.Change_Date as Change7_33_1_, discipline3_.Change_User_ID as Change8_33_1_, discipline3_.Main_Discipline_Code as Main9_33_1_, discipline4_.Name_French as Name2_33_2_, discipline4_.Name_English as Name3_33_2_, discipline4_.Active_Ind as Active4_33_2_, discipline4_.Create_Date as Create5_33_2_, discipline4_.Create_User_ID as Create6_33_2_, discipline4_.Change_Date as Change7_33_2_, discipline4_.Change_User_ID as Change8_33_2_, discipline4_.Main_Discipline_Code as Main9_33_2_, discipline5_.Name_French as Name2_33_3_, discipline5_.Name_English as Name3_33_3_, discipline5_.Active_Ind as Active4_33_3_, discipline5_.Create_Date as Create5_33_3_, discipline5_.Create_User_ID as Create6_33_3_, discipline5_.Change_Date as Change7_33_3_, discipline5_.Change_User_ID as Change8_33_3_, discipline5_.Main_Discipline_Code as Main9_33_3_, discipline6_.Name_French as Name2_33_4_, discipline6_.Name_English as Name3_33_4_, discipline6_.Active_Ind as Active4_33_4_, discipline6_.Create_Date as Create5_33_4_, discipline6_.Create_User_ID as Create6_33_4_, discipline6_.Change_Date as Change7_33_4_, discipline6_.Change_User_ID as Change8_33_4_, discipline6_.Main_Discipline_Code as Main9_33_4_, discipline7_.Name_French as Name2_33_5_, discipline7_.Name_English as Name3_33_5_, discipline7_.Active_Ind as Active4_33_5_, discipline7_.Create_Date as Create5_33_5_, discipline7_.Create_User_ID as Create6_33_5_, discipline7_.Change_Date as Change7_33_5_, discipline7_.Change_User_ID as Change8_33_5_, discipline7_.Main_Discipline_Code as Main9_33_5_ from FORMS form0_ inner join PERSON person1_ on form0_.CID=person1_.CID left outer join PERSON_EXPERTISE personexpe2_ on person1_.CID=personexpe2_.CID left outer join DISCIPLINE discipline3_ on personexpe2_.Discipline_Code_1=discipline3_.Discipline_Code left outer join DISCIPLINE discipline4_ on personexpe2_.Discipline_Code_2=discipline4_.Discipline_Code left outer join DISCIPLINE discipline5_ on personexpe2_.Discipline_Code_3=discipline5_.Discipline_Code left outer join DISCIPLINE discipline6_ on personexpe2_.Discipline_Code_4=discipline6_.Discipline_Code left outer join DISCIPLINE discipline7_ on personexpe2_.Discipline_Code_5=discipline7_.Discipline_Code where form0_.Form_ID=?]

com.sybase.jdbc2.jdbc.SybSQLException: Select expression results in more than one column having same name. Column name 'Discipline1_33_3_' is specified more than once


at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)

at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)

at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)

at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)

at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)

at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1510)

at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1495)

at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:70)

at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)

at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:137)

at org.hibernate.loader.Loader.getResultSet(Loader.java:1676)

at org.hibernate.loader.Loader.doQuery(Loader.java:662)

at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)

at org.hibernate.loader.Loader.doList(Loader.java:2147)

at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)

at org.hibernate.loader.Loader.list(Loader.java:2021)

at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)

at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:298)

at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1020)

at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)

at ca.sshrc.web.common.services.TestDBAHibernate.TestDBAHibernate(TestDBAHibernate.java:20)

at ca.sshrc.web.common.services.CacheInit.<init>(CacheInit.java:39)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:274)

at java.lang.Class.newInstance0(Class.java:308)

at java.lang.Class.newInstance(Class.java:261)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:987)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)

at org.apache.catalina.core.StandardService.start(StandardService.java:480)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)

at org.apache.catalina.startup.Catalina.start(Catalina.java:556)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 7348, SQLState: ZZZZZ

ERROR [main] (JDBCExceptionReporter.java:72) - Select expression results in more than one column having same name. Column name 'Discipline1_33_3_' is specified more than once


WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 7348, SQLState: ZZZZZ

ERROR [main] (JDBCExceptionReporter.java:72) - Select expression results in more than one column having same name. Column name 'Discipline1_33_4_' is specified more than once


WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 7348, SQLState: ZZZZZ

ERROR [main] (JDBCExceptionReporter.java:72) - Select expression results in more than one column having same name. Column name 'Discipline1_33_5_' is specified more than once


WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 7348, SQLState: ZZZZZ

ERROR [main] (JDBCExceptionReporter.java:72) - Select expression results in more than one column having same name. Column name 'Discipline1_33_3_' is specified more than once


WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 7348, SQLState: ZZZZZ

ERROR [main] (JDBCExceptionReporter.java:72) - Select expression results in more than one column having same name. Column name 'Discipline1_33_4_' is specified more than once


WARN [main] (JDBCExceptionReporter.java:71) - SQL Error: 7348, SQLState: ZZZZZ

ERROR [main] (JDBCExceptionReporter.java:72) - Select expression results in more than one column having same name. Column name 'Discipline1_33_5_' is specified more than once


org.hibernate.exception.GenericJDBCException: could not execute query

at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

at org.hibernate.loader.Loader.doList(Loader.java:2150)

at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2026)

at org.hibernate.loader.Loader.list(Loader.java:2021)

at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:369)

at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:298)

at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1020)

at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)

at ca.sshrc.web.common.services.TestDBAHibernate.TestDBAHibernate(TestDBAHibernate.java:20)

at ca.sshrc.web.common.services.CacheInit.<init>(CacheInit.java:39)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:274)

at java.lang.Class.newInstance0(Class.java:308)

at java.lang.Class.newInstance(Class.java:261)

at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:987)

at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:862)

at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4013)

at org.apache.catalina.core.StandardContext.start(StandardContext.java:4357)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

at org.apache.catalina.core.StandardHost.start(StandardHost.java:789)

at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1083)

at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:478)

at org.apache.catalina.core.StandardService.start(StandardService.java:480)

at org.apache.catalina.core.StandardServer.start(StandardServer.java:2313)

at org.apache.catalina.startup.Catalina.start(Catalina.java:556)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:284)

at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:422)

Caused by: com.sybase.jdbc2.jdbc.SybSQLException: Select expression results in more than one column having same name. Column name 'Discipline1_33_3_' is specified more than once


at com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2636)

at com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:1996)

at com.sybase.jdbc2.jdbc.ResultGetter.nextResult(ResultGetter.java:69)

at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:204)

at com.sybase.jdbc2.jdbc.SybStatement.nextResult(SybStatement.java:187)

at com.sybase.jdbc2.jdbc.SybStatement.queryLoop(SybStatement.java:1510)

at com.sybase.jdbc2.jdbc.SybStatement.executeQuery(SybStatement.java:1495)

at com.sybase.jdbc2.jdbc.SybPreparedStatement.executeQuery(SybPreparedStatement.java:70)

at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:92)

at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:137)

at org.hibernate.loader.Loader.getResultSet(Loader.java:1676)

at org.hibernate.loader.Loader.doQuery(Loader.java:662)

at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:223)

at org.hibernate.loader.Loader.doList(Loader.java:2147)

... 31 more


Name and version of the database you are using: Sybase ASE 12.0.0.1


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

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.