About SUM

manual

GROUP BY and HAVING clauses

Explains how to use the GROUP BY and HAVING clauses in a JPA/JPQL query.... combination). Aggregate calculations (count, sum, avg, max, min) that are carried out on all the objects (or the object ... representing the number of elements. SUM - returns the sum of numeric values. AVG - ...

 
api-jpa

sum(x)

Create an aggregate expression applying the sum operation.(Method of javax.persistence.criteria.CriteriaBuilder)

 
api-jpa

sum(x, y)

Create an expression that returns the sum of its arguments.(Method of javax.persistence.criteria.CriteriaBuilder)

 
api-jpa

sum(x, y)

Create an expression that returns the sum of its arguments.(Method of javax.persistence.criteria.CriteriaBuilder)

 
api-jpa

sum(x, y)

Create an expression that returns the sum of its arguments.(Method of javax.persistence.criteria.CriteriaBuilder)

 
issue

Wrong type on SUM function

Hello, I have a problem when I run this aggregation query: ... ( "SELECT cc.totalCC.moneda, SUM(cc.totalCC.importe) FROM ComprobanteContable cc " + "WHERE ... ( ) ; The problem is about SUM on cc.totalCC.importe, a BigDecimal field. It works fine on all groups ...

 
api-jpa

javax.persistence.criteria.CriteriaBuilder

Used to construct criteria queries, compound selections, expressions, predicates, orderings.(Interface of JPA)

 
manual

Numbers in JPQL and Criteria Queries

Shows how numbers, arithmetic expressions and numeric functions and operators (MOD, ABS) can be used in JPQL queries.... Reference Page... <Integer> sum1 = cb. sum sum(x, y) CriteriaBuilder's method Create an expression that ...

 
api-jpa

sumAsLong(x)

Create an aggregate expression applying the sum operation to an Integer-valued expression, returning a Long result.(Method of javax.persistence.criteria.CriteriaBuilder)

 
api-jpa

sumAsDouble(x)

Create an aggregate expression applying the sum operation to a Float-valued expression, returning a Double result.(Method of javax.persistence.criteria.CriteriaBuilder)