Reputation: 15
I am trying to add up all the prices in one column, but it outputs a ridiculous total. Please help, not sure if my query is incorrect. Thanks.
@NamedQuery(name = "Tyrerange.totalCost", query = "SELECT SUM(t.dblTyreCost) FROM Tyrerange t"),
double totalCost = (double) em.createNamedQuery("Tyrerange.totalCost").getSingleResult();
document.add(new Paragraph(String.valueOf((df.format(totalCost)))));
Upvotes: 0
Views: 1728
Reputation: 1695
The query looks ok. Maybe the cached values are being read. Create a new query and sum some other column to check this.
Upvotes: 1