Skip to content

Using the result of a group by to select

gert-wijns edited this page Sep 13, 2014 · 2 revisions

The query.groupBy(val) returns a TypeSafeValue which can be used to reduce the amount of code you need to write.

Building building = query.from(Building.class);
query.select(query.groupBy(building.getConstructionDate()).select());
query.select(query.groupBy(building.getStyle()).select());

=> "select hobj1.constructionDate, hobj1.style
    from Building hobj1
    group by hobj1.constructionDate, hobj1.style"
Clone this wiki locally