I have many to many relation between Posts and Tags tables. Using HQL I want to get only a few fields from Posts table and names of the tags. So I wrote:
select p.field1, p.field2, count(distinct p.field3), t.Name from Post p left join p.Tags t group by p.field1, p.field2, t.Name
I want to have post data and list of its tags.
Result looks that, I have duplicated data for posts. Using criteria, I have there setResultTransformer which I can use with DistinctRootEntty for eager loading and it works. But using this transformer with HQL, it only removes me the duplicated data for posts and lives list of list of tags names.
My question is, is there a possibility to do it that easy like it is for icriteria? Or I'm stuck with manually parsing the result on client?