title: Using spring jdbc template to query for list of parameters
body: <p>New to Spring JDBC template but I'm wondering if I am able to pass a list of parameters and execute query once for each parameter in list. As I've seen many examples, the list of parameters being passed is for the execution of the query using all the parameters provided. Rather I am trying to execute query multiple times and for each time using new parameter in list.</p>
  
  <p>For example:
  Let's say I have a List of Ids - params (Strings)</p>
  
  <pre><code>List&lt;String&gt; params = new ArrayList&lt;String&gt;();
  params.add("1234");
  params.add("2345");
  </code></pre>
  
  <p>trying to do something like:</p>
  
  <pre><code>getJdbcTemplate().query(sql, params, new CustomResultSetExtractor());
  </code></pre>
  
  <p>which I know as per documentation is not allowed. I mean for one it has to be an array. I've seen simple examples where query is something like <code>"select * from employee where id = ?"</code> and they are passing <code>new Object[]{"1234"}</code> into method. And I'm trying to avoid the IN() condition. In my case each id will return multiple rows which is why I'm using ResultSetExtractor.</p>
  
  <p>I know one option would be to iterate over list and include each id in list as a parameter, something like:</p>
  
  <pre><code>for(String id : params){
    getJdbcTemplate().query(sql, new Object[]{id}, new CustomResultSetExtractor());
  }
  </code></pre>
  
  <p>Just want to know if I can do this some other way. Sorry, I Should mention that I am trying to do a Select. Originally was hoping to return a List of custom objects for each resultset.</p>