Search code examples
jpatuplescriteriacriteria-api

JPA Criteria in clause with tuple expression


Looking to translate an HQL query into it's JPA Criteria API equivalent.

In HQL I have the following which seems to work.

WHERE (x, y) IN (
    ... sub query which selects two columns
)

In JPA Criteria API I don't see how I can match a tuple value, only a single value. For example, I know how to convert the following to JPA Criteria.

WHERE (x) IN (
    ... sub query which selects single column
)

Is this even possible using the criteria api?


Solution

  • It's not possible in JPQL to try to match two fields with the IN.

    By the way, you can't do it in JPA Criteria neither.