-->
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: problem with <one-to-many> pls help..
PostPosted: Mon Jan 30, 2006 5:25 pm 
Beginner
Beginner

Joined: Sun Jan 22, 2006 8:47 pm
Posts: 31
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


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.