标签: hibernate hql
Pvp是十进制,但返回一个Long对象
session.createQuery("select SUM(cantidad*pvp) from LineaPedido where num_pedido IN (select num_pedido from Pedido where id_cliente like " + cliente.getId_cliente() +")").uniqueResult();
但是如果我将SUM更改为AVG,它将返回一个Double对象
答案 0 :(得分:0)
它将返回正确的类型。
请参阅https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/dialect/function/StandardAnsiSqlAggregationFunctions.java