Newer versions of MySql have the concept of a row constructor expression, which enables querying by conditions consisting of a subset of columns matching one of the given entries in a list of tuples; e.g.:
SELECT * FROM t WHERE (c1, c2) IN ((1, 1), (2, 2))
returns all the entries that have (c1 = 1 and c2 = 1) or (c1 = 2 and c2 = 2). My question is whether this can be achieved with Spring JPA without using native queries, which would make the code db-provider-dependent.
As a dummy example, say I have a class Foo with integer fields bar and baz and a list of Foos. I want to build an Spring JPA query that would yield all the db entries from table A(c1, c2, c3) that match one of my Foos, having c1 = bar and c2 = baz.
I couldn't find any reference in the Spring docs.
If there is (yet) no solution to this problem, then I'm wondering whether doing a full select then filtering in code is better than doing N queries for individual entries, taking into consideration that the table is small (thousands of entries).