I'm trying to create a query with a IN clause that maps a table with other that have a composite key. For reference the first table maps a composite key (three columns) to OtherTable
(contains a OtherTableId
object).
Example:
select t1
from Table t1
where t1.otherTable in :listOfOtherTables;
...
List<OtherTable> listOfOtherTables= Arrays.asList(new OtherTable(...), ...);
query.setParameter("listOfOtherTables", listOfOtherTables);
I searched how to do this and is pretty straightforward. In fact I use this with strings with success like this:
select t1
from Table t1
where t1.states in :listOfStates;
...
List<String> listOfStates = Arrays.asList("A", "B");
query.setParameter("listOfStates", listOfStates);
When I run the first example (by the way the project is in Spring 4.2 + Weblogic 12.1.2), the transformation for the query to be executed in Oracle is this:
select t1
from Table t1
where (NULL, NULL NULL) IN (("value1", "value2", "value3"), ("value1", "value2", "value3), ...);
Where is supposed to be the column names, appears NULL.
Anyone can help me?
PS: I have tried this also:
select t1
from Table t1
where t1.otherTable in (:otherTableObject1, :otherTableObject2, otherTableObject3);
Also doesn't work.