JPA Count * of Group By结果

时间:2015-11-28 05:08:47

标签: java mysql spring-mvc jpa-2.0 jpql

我有以下SQL查询:

select count(*) from (
    select *, count(*)  
    from po_item 
    where sku_code ="SKU_TEST_4" and allocated = false and wip = false 
    group by warehouse
) as t

我能够使用Criteria API和JPQL

编写以下内部查询
select *, count(*)
from po_item 
where sku_code ="SKU_TEST_4" and allocated = false and wip = false
group by warehouse

但无法将其与外部部分一起编写。如何使用JPQL或Criteria API执行此操作?

0 个答案:

没有答案