right now I'm translating some HQL-code into programmed Java code using the Criteria from Hibernate.
I want to select some objects of the type Sector grouped by the sector.id and ordered by the size of its containing Publiction-Set. My HQL code is working fine:
My criteria-code looks like:
SELECT sector FROM Sector AS sector LEFT JOIN sector.publications AS publication WHERE sector.name LIKE :firstCharacter GROUP BY sector.id
The order is correct, but I get list of Object containing the id and the publications count. Indeed this ist right, but I want to get a list only filled with Sector-Objects.
Criteria criteria = session.createCriteria(Sector.class)
Can someone can help me?