-->
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: HQL
PostPosted: Tue Jul 19, 2011 4:32 am 
Newbie

Joined: Tue Jul 19, 2011 4:13 am
Posts: 1
Hi All,

I am having 3 tables: USER, ADDRESS, ADDRESSSET in an oracle database.
The structure of these 3 tables are as follows:

USER:
USERID [PRIMARY_KEY]
FIRSTNAME
LASTNAME
EMAIL

ADDRESSSET:
ADDRESSSETID [PRIMARY_KEY]
USERID [FOREIGN_KEY FROM USER]
ADDRESSID [FOREIGN_KEY FROM ADDRESS]

ADDRESS:
ADDRESSID [PRIMARY_KEY]
ADDRESSTYPE [Ex: HOME, OFFICE, SHIPPING etc...]
LINE1
LINE2
CITY
STATE
COUNTRY

ADDRESSSET table behaves as link table. It has been designed this way to share addresses among different users.
I have created hibernate mapping files and POJOs for these 3 tables.

Now, I need to write a method where input parameter will be List<Long> userIdList.
And, return type must be List<User> where User has his address details i.e. his office, home & shipping address.

I have written an HQL:
from User u
left outer join u.profileaddresssets as uas
left outer join uas.address add
where u.userid in (:userIdList)


But, the result of this HQL is a List<Object[ ]> instead of List<User>.
Is it possible to get List<User>? If yes, then, How?

Thanks & Regards,
Sumved Shami


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.