我试图将所有价格加起来在一列中,但它输出的总数很荒谬。请帮忙,不确定我的查询是否不正确。谢谢。
@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)))));