Reputation: 55
I did a query to get the sum of values in a table:
List<Double> resultList = (List<Double>) em.createQuery("SELECT sum(v.prices) FROM Ship v).getResultList();
The problem is that even though i typed as Double, the return continues to be Long and the decimals are not included.
Can someone help me with this issue? Pls
Thanks!
Upvotes: 0
Views: 1342
Reputation: 89
try this :
List<Double> resultList = (List<Double>) em.createQuery("SELECT sum(cast(v.prices as double)) FROM Ship v).getResultList();
Upvotes: 1