Hi All,
I am facing one problem, I have tried alll forums but did't get the solution.
Example:-
I have following classes: Person,CompanyDetails,Ocupation and tables: PERSON, COMPANY, COMPANY_DETAILS, OCCUPATION
Person class has following mapping :
<many-to-one name="ocupation" column="OCC_ID" lazy="false" not-null="true"/>
<set name="companyDetails" table="COMPANY" schema="x" lazy="false" fetch="join">
<key column="PERSON_OCC_ID" property-ref="ocupation">
<many-to-many class="com.company.CompanyDetails" column="DETAIL_ID">
</set>
Now my set which is company details , it points to a table COMPANY which has a column PERSON_OCC_ID which is a foregin key to PERSON table's OCC_ID(which is a non-primary key of PERSON table). SO, I am using property-ref in the key column. But this is giving ClassCastException, Becuase it's fetching Ocupation istead of CompanyDetails. If I remove property-ref it's comparing with the primary key of PERSON table, which is not my requirement
|