Merge pull request #1913 from ebean-orm/feature/MaxMin

Change to use @Aggregation as meta annotation - support newly added @Max, @Min, @Avg annotations
This commit is contained in:
Rob Bygrave authored and GitHub committed 2020-01-14 16:41:44 +13:00
commit 7d98355d39
3 files changed
+4 -7

No files matched your search

@@ -315,11 +315,7 @@ public class AnnotationFields extends AnnotationParser {
Aggregation aggregation = get(prop, Aggregation.class);
if (aggregation != null) {
prop.setAggregation(aggregation.value());
}
Sum sum = get(prop, Sum.class);
if (sum != null) {
prop.setAggregation("sum(" + prop.getName() + ")");
prop.setAggregation(aggregation.value().replace("$1", prop.getName()));
}
Version version = get(prop, Version.class);
@@ -1,6 +1,7 @@
package org.tests.model.aggregation;
import io.ebean.annotation.Aggregation;
import io.ebean.annotation.Max;
import io.ebean.annotation.Sum;
import io.ebean.annotation.View;
@@ -24,7 +25,7 @@ public class DMachineStatsAgg {
@Aggregation("sum(hours)") // which is the same as: @Sum
long hours;
@Aggregation("max(rate)")
@Max
BigDecimal rate;
/**