'Criteria Query JPA with pair wise IN clause

I have this following query. I need a way to write it using JPA criteria Query.

Select a from alpha a where a.id in (select b.id from beta b where (b.tag_key,b.tag_value) in ((:paramkey1, :paramval1),(:paramkey2, :paramval2)) group by b.id having count(*) = :paramListSize)

Note : (paramkey, paramvalue) is a list of paramNodes where each paramNode hold one paramkey and one paramValue. So this tagKey, tagValue pair parameters is a dynamic one.

I have solved the problem with jpql but I see that when I tried to solve it using JPA criteria Query it is not able to create the same query while hitting DB - especially the pair wise part is not configured.

Any help is very much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source