I need using JPA to find records by matching 2 grouped parameters from a table but my problem is that I don't know how to pass an object or grouped parameter in SQL, if that is possible at all.
Let's say we have the User table:
USER_TABLE
name VARCHAR,
email VARCHAR,
address VARCHAR
I need to find all users where grouped name and email match. Something like this:
SELECT FROM USER_TABLE
WHERE (name, email)
IN (('John', 'john@mail'), ('Oliver', 'oliver@mail'));
It works in SQL tool but now I need to use this SQL from Java
To do so I udpated it to accept a parameter
SELECT FROM USER_TABLE
WHERE (name, email)
IN (?);
So my question is HOW do I pass parameters or so that they will be grouped?
I tried to create a parameter as it is below but it won't work because it is not a valid type
String param = "('John', 'john@mail'), ('Oliver', 'oliver@mail')";
db.execute(sql, param)
Is that possible at all?