Hi again. Things are going pretty well, but I've stumbled on a complicated query. The query below is an example of something which contains several different elements, and I must admit I'm struggling to convert this into HQL. I would really appreciate any help.
Code:
select tableA.id, tableA.name, tableB.user_id,
sum(tableB.val1), sum(tableB.val2), count(tableB.id)
where tableB.user_id=tableA.id
and tableA,name='x'
group by tableB.user_id
order by sum(tableB.val1) desc, sum(tableB.val2), tableA.name
So basically it's a select with some kind of join, which selects specific rows from more than one table. How can this handled in Hibernate, as this cannot return a particular object type? So far, all my queries have returned a List of one of my objects, or one particular data type. Whereas this needs to return varying values from two tables.
Any advice on a) how to get this into HQL, and b) how to process the return values, greatly appreciated!