Hi
My main table is PTNT_DATA_MSRMNT_CLCTN & join table is PTNT_PRCTC_PRFMNC_YR. I want to join these 2 tables by a non-primary key (in the main table), but it does not work.
Tables:
Code:
PTNT_DATA_MSRMT_CLCTN :
PTNT_DATA_MSRMNT_CLCTN_ID (PK)
PTNT_PRCTC_PRFMNC_YR_ID
DEMO_PRCTC_DATA_CLCTN_PRD_ID
PTNT_PRCTC_PRFMNC_YR:
PTNT_PRCTC_PRFMNC_YR_ID (PK)
DEMO_PRCTC_ID
DEMO_PRFMNC_YR_ID
PTNT_ID
Mapping:
Code:
<class name="PatientDataMeasurementCollection" table="PTNT_DATA_MSRMNT_CLCTN">
<id name="patientDataMeasurementCollectionId"
column="PTNT_DATA_MSRMNT_CLCTN_ID"
type="long">
<generator class="assigned" />
</id>
<property name="demoCollectionPeriodId"
column="DEMO_PRCTC_DATA_CLCTN_PRD_ID"
type="long" />
<property name="patientPracticePerformanceYearId"
column="PTNT_PRCTC_PRFMNC_YR_ID"
type="long" />
<join table="PTNT_PRCTC_PRFMNC_YR"
optional="false">
<key column="PTNT_PRCTC_PRFMNC_YR_ID" unique="true" property-ref="patientPracticePerformanceYearId" />
<many-to-one name="patient"
column="PTNT_ID"
not-null="true"
fetch="join" />
</join>
</class>
Now I need to join by PTNT_PRCTC_PRFMNC_YR_ID on these 2 tables. But the generated SQL has this in the where clause:
where this_.PTNT_DATA_MSRMNT_CLCTN_ID=this_1_.PTNT_PRCTC_PRFMNC_YR_ID.
But It should rather be
this_.PTNT_PRCTC_PRFMNC_YR_ID=this_1_.PTNT_PRCTC_PRFMNC_YR_ID.
Hibernate version : 3.2.7.ga
Can you guys help me on this. Hope I have made my issue clear & is understandable.
Thanks
Harish