-->
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.  [ 2 posts ] 
Author Message
 Post subject: Multiple joins ...
PostPosted: Tue Jul 22, 2008 2:27 pm 
Newbie

Joined: Thu Jul 17, 2008 1:06 pm
Posts: 6
Location: elkridge
Here is my situation.
I have a person mapping file, address mapping file and phoneNumbers.

relation exist between person, phonNumber and person, address
can any one give me the Hql query to get these fields
1. phoneNumber(phoneNumber)
2.addressline1(address)
3.FirstName(person)

based on the lastname of the person.
please help me to solve this

_________________
chandra


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jul 23, 2008 2:58 am 
Expert
Expert

Joined: Thu Dec 14, 2006 5:57 am
Posts: 1185
Location: Zurich, Switzerland
Code:
select p.FirstName, a.Addressline1, pn from Person p
inner join p.Address a
inner join p.PhonNumber pn
where p.LastName = "myname";


If you don't want the whole pn object, use pn.PhoneNumber or whatever you need.

_________________
--Wolfgang


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

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.