• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Result of HQL for associated objects

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 [Example: HOME, OFFICE, SHIPPING]
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 user
left outer join user.profileaddresssets as uas
left outer join uas.address add
where user.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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic