This is my first experience with JDBCTemplates and I ran into a case where I need to use a query that looks like this:
SELECT * FROM table WHERE field IN (?)
How do I do that? I already tried passing a list/array value but that didn't do the trick, I get an exception. My current code looks like this:
Long id = getJdbcTemplate().queryForLong(query, new Object[]{fieldIds});
Spring Documentation states that there is no way of doing this besides generating the required number of "?" placeholders to match the size of the parameter List. Is there a workaround?
IN
clause does not accept a single variable to represent a list of values -- no database does, without using dynamic SQL. – Galactose