【发布时间】:2015-09-20 02:49:23
【问题描述】:
我收到 Hibernate 的消息,我有一个“命名查询错误”。
下面是我尝试执行的 HQL 语句。
select sum(subtotal)
from (
select sum(coalesce(sum(t2.amount), 0) - coalesce(sum(t3.amount), 0)) subtotal
from submission t1
left join t1.bills t2
left join t1.payments t3
where t1.id = 10
group by t1.id
union
select sum(coalesce(sum(t2.amount), 0) - coalesce(sum(t3.amount), 0)) subtotal
from submission t1
left join t1.otherBills t2
left join t1.payments t3
where t1.id = 10
group by t1.id
) a1
我认为问题可能与外部查询中的sum 函数或union 运算符有关,但我无法缩小范围。
有人有什么想法吗?
【问题讨论】: