@Retention(value=RUNTIME) @Target(value=FIELD) public @interface Aggregation
The aggregation formula should be a sum, count, avg, min or max. By default aggregation properties are treated as transient and not included in a query. To populate the aggregation property it must be explicitly included in the select().
@Aggregation("count(details)")
Long totalCount;
@Aggregation("sum(details.quantity*details.unitPrice)")
Long totalAmount;
List<TEventOne> list = Ebean.find(TEventOne.class)
.select("name, totalCount, totalUnits, totalAmount")
.where()
.startsWith("logs.description", "a")
.having()
.ge("count", 1)
.orderBy().asc("name")
.findList();
Copyright © 2019. All rights reserved.