title: JDBC createArrayOf from ArrayList
body: <p>I want to set a <code>WHERE IN</code> clause in sql, so I want to do a <code>preparedStatement.setArray(1, some_ids)</code>.</p>
  
  <p>I can create a <code>sql.Array</code> like this:</p>
  
  <p><code>Array some_ids = conn.createArrayOf("INTEGER", new Object[]{"1", "2","3"});</code></p>
  
  <p>But how do I do this with an <code>ArrayList&lt;Integer&gt;</code>?</p>
  
  <pre><code>ArrayList&lt;Integer&gt; array_list_ids = new ArrayList&lt;Integer&gt;();
  array_list_ids.add(1);
  array_list_ids.add(2);
  array_list_ids.add(3);
  Array some_ids = conn.createArrayOf("INTEGER", array_list_ids);
  </code></pre>
  
  <p>I get</p>
  
  <pre><code>java: incompatible types: java.util.ArrayList&lt;java.lang.Integer&gt; cannot be converted to java.lang.Object[]
  </code></pre>