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
2020-01-14 16:41:44 +13:00
committed by GitHub
3 changed files with 4 additions and 7 deletions
+1 -1
View File
@@ -118,7 +118,7 @@
<dependency>
<groupId>io.ebean</groupId>
<artifactId>ebean-annotation</artifactId>
<version>6.1</version>
<version>6.2</version>
</dependency>
<dependency>
@@ -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;
/**