I wanted to do the simple queries: "select userid, count(*) from roles group by userid" "select count(*) from entries where userid=:userid"
And I found it was difficult to do through Ebean. RawSql might work, but it's not easy or elegant, and even with that, I don' think there is a way to return the result to a scalar or other non entity classes.
In these cases of doing flat non-oo type report queries, it should be possible to return the result as a List or List>.
Long customerCount = Ebean.find(Customer.class).select("count(*)").findScalar(Long.class);
List> customersCount = Ebean.find(Customer.class).select("customerId, count(*)".where().like("name", name).groupBy("customerid").findList.class>);
List customersCount = Ebean.find(Customer.class).select("customerId, count(*)".groupBy("customerid").findList);