diff --git a/pom.xml b/pom.xml
index bc8d50783..7420f8b40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -117,7 +117,7 @@
io.ebean
ebean-annotation
- 4.4
+ 4.5
diff --git a/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java b/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java
index 8c2f48754..c140b4cc0 100644
--- a/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java
+++ b/src/main/java/io/ebeaninternal/server/deploy/parse/AnnotationFields.java
@@ -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) {
diff --git a/src/test/java/org/tests/model/aggregation/DMachineStatsAgg.java b/src/test/java/org/tests/model/aggregation/DMachineStatsAgg.java
index 94f642d9c..0f4774a5c 100644
--- a/src/test/java/org/tests/model/aggregation/DMachineStatsAgg.java
+++ b/src/test/java/org/tests/model/aggregation/DMachineStatsAgg.java
@@ -1,6 +1,7 @@
package org.tests.model.aggregation;
import io.ebean.annotation.Aggregation;
+import io.ebean.annotation.Sum;
import io.ebean.annotation.View;
import javax.persistence.Entity;
@@ -17,16 +18,10 @@ public class DMachineStatsAgg {
LocalDate date;
- /**
- * Matching with column underscore.
- */
- @Aggregation("sum(totalKms)")
+ @Sum // which is the same as: @Aggregation("sum(totalKms)")
long totalKms;
- /**
- * Matching with no underscore.
- */
- @Aggregation("sum(hours)")
+ @Aggregation("sum(hours)") // which is the same as: @Sum
long hours;
@Aggregation("max(rate)")