Reputation: 63
I have native query like this
SELECT sample.api_name,
sample.hitcount,
r.unit_rate*sample.hitcount AS amnt
FROM
(SELECT u.api_name AS api_name,u.tenant_id,
u.count AS hitcount
FROM tableA u
WHERE u.tenant_id = :tenant
AND u.time_stamp BETWEEN :dateFrom AND :dateTo
GROUP BY u.api_name,
u.tenant_id) AS sample
LEFT JOIN tableB r ON sample.api_name = r.api_name
AND sample.tenant_id =r.tenant_id
The values "tenant,dateFrom,dateTo" values are providing by using @Param tag.
I have tried to convert to the jpql query in spring data jpa. But by seeing in some reference documents i came to know that the Jpql inner queries are not supported in the FROM clause.
is that my point correct or not. If not Please help me to write in JPQL if my point is correct please help to write in Criteria api.
Upvotes: 0
Views: 47