title: How to use an arraylist as a prepared statement parameter
body: <p>I have looked and have been unable to find an answer to the following challenge I am having.  It
  seems pretty straightforward but I have been unable to resolve it.</p>
  
  <p>I have an <code>ArrayList</code> of record ids that are type <code>Long</code> -> <code>ArrayList&lt;Long&gt;</code>.  I would like to use
  this list of record ids to select rows from another table.  So far so good.  Now onto the 
  challenge...</p>
  
  <p>a) I am using a prepared statement to select the data from a table using the <code>ArrayList</code> as input
     for this.  </p>
  
  <pre><code>selectPS = dbConnection.prepareStatement("select columnA from tableA where id in ?");
  </code></pre>
  
  <p>Question on the above - how should the parameter be defined?  The above does not seem correct for
     an <code>ArrayList</code> type parameter.</p>
  
  <p>b) I am also running into problems when setting the value of the parameter for the prepared
     statement.  There is no method for setting an <code>ArrayList</code> type value and I see no other viable
     options.</p>
  
  <pre><code>---&gt; selectPS.set?????(1, arraylistParameter);
       ResultSet rs = selectPS.executeQuery(); 
  </code></pre>
  
  <p>Any help or direction you can set me in is greatly appreciated.</p>
  
  <p>Thank you.</p>