I have the following SQL query:
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
I was able to write the following inner query with Criteria API and JPQL
select *, count(*)
from po_item
where sku_code ="SKU_TEST_4" and allocated = false and wip = false
group by warehouse
but couldn't write it along with the outer part. How to do it with JPQL or Criteria API?