#1618 - ENH: Add @Sum ... as short hand for @Aggregation("sum(<property name>)")

This commit is contained in:
rob bygrave
2019-01-23 00:29:51 +13:00
parent a83896f1ff
commit 396fb49acd
3 changed files with 9 additions and 9 deletions
@@ -25,6 +25,7 @@ import io.ebean.annotation.Index;
import io.ebean.annotation.JsonIgnore;
import io.ebean.annotation.Length;
import io.ebean.annotation.SoftDelete;
import io.ebean.annotation.Sum;
import io.ebean.annotation.TenantId;
import io.ebean.annotation.UnmappedJson;
import io.ebean.annotation.UpdatedTimestamp;
@@ -285,6 +286,10 @@ public class AnnotationFields extends AnnotationParser {
if (aggregation != null) {
prop.setAggregation(aggregation.value());
}
Sum sum = get(prop, Sum.class);
if (sum != null) {
prop.setAggregation("sum(" + prop.getName() + ")");
}
Version version = get(prop, Version.class);
if (version != null) {