I have a table named group_table in MySQL with only two columns user_group_id and group_id (both of them are of type VARCHAR
You can use a field concatenation approach to solve the problem.
Create a method that returns the two fields you want to search in your DTO/Entity.
public String getField1Field2Concatenated() {
return field1+ field2;
}
List ids = list.stream().map(r -> r.getField1Field2Concatenated()).collect(Collectors.toList());
You can concatenate two fields and do the search.
Select e from Entity e where concat(e.field1, c.field2) in (:ids)
If any of the fields are not text you can cast
Select e from Entity e where concat(cast(c.field1 as string), c.field2) in (:ids)