Hi,
I have a different situation where I do select not on primary Key..
My mappings file:
<class name="Person" table="person">
<id name="pId" column="p_id" >
<generator class="assigned"/>
</id>
<property name="lastName" column="last_name" type="string" />
<many-to-one name="contactInfo" class="Contact" column="phys_id"/>
</class>
________________
<class name="Contact" table="contact">
<id name="cId" type="int" column="c_id" >
<generator class="assigned"/>
</id>
<property name="physId" column="phys_id" type="int" />
<set name="personSet" lazy="false" table="person" inverse="true">
<key column="pId"/>
<one-to-many class="Person" />
</set>
</class>
My problem is I want to query like:
select con.physId , per.lastName from Contact con , con.personSet per
and i want the hibernate to do join using :
contact.PhysId and person.pId
but hibernate implicitly joins on the two primary keys...How I can force the join on my own specific keys...
I specified the required columns in "column" attribute in<one-to-many > and <many-to-one>,But of no result..
Can anyone pls help me..
Thnx
|