• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

hibernate - how to handle a query that returns more types of objects

 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I have this query:



I'm trying to populate 3 beans from a single row. Anyone has some suggestions, or a better approach for retrieving data from 3 tables?
Thanks.
 
ishan dave
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Nick,

you need to take an object array and fetch these three object.

now iterate to your array and caste them.

This is the most simplest way I think for your requirement.

thank you,
ishaan
 
Nick Potter
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
query.list() returns a list of objects consisting of the combined rows of those 3 tables. I cannot access these (or i don't know how).
 
Christian Dillinger
Ranch Hand
Posts: 200
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As ishan dave posted, you get an Object[]. First item is a Subscription, second is a Product, third is a Customer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic