title: Passing array object to jdbc query
body: <p>I am developing an application in which i want to compare the list of phone numbers from the mobile device with database(MYSQL). I am passing phone numbers as array list.</p>
  
  <p>here is my code:</p>
  
  <pre><code>ArrayList&lt;String&gt; arrayList = new ArrayList&lt;String&gt;();
      arrayList.add("1212121212");
      arrayList.add("1234567890");
      arrayList.add("1515151515");
      arrayList.add("1111111111");
      arrayList.add("2222222222");
      arrayList.add("3333333333");
  
      List&lt;UserDO&gt; userDOs = userDAOImpl.getExistingMobileNumber(arrayList);
  </code></pre>
  
  <p>The above code is my test case and the following code is my database query for selecting mobile number</p>
  
  <pre><code>private static final String SELECT_MOBILE_NUMBER = "SELECT USER_ID, USER_NAME, REGISTRATION_ID, MOBILE_NUMBER FROM USER WHERE MOBILE_NUMBER IN (?)";
  </code></pre>
  
  <p>Here is my DAOImpl code:</p>
  
  <pre><code>public List&lt;UserDO&gt; getExistingMobileNumber(ArrayList&lt;String&gt; mobileNumbers) throws UserDataException {
      JdbcTemplate jd = this.getJdbctemplate();
      List&lt;UserDO&gt; userDOs = jd.query(SELECT_MOBILE_NUMBER, new Object[] { mobileNumbers }, new RowMapper&lt;UserDO&gt;(){
  
          @Override
          public UserDO mapRow(ResultSet rs, int rowNum) throws SQLException {
              UserDO userDO = new UserDO();
              userDO.setMobileNumber(rs.getString(4));
              return userDO;
          }
  
      });
      return userDOs;
  }
  </code></pre>
  
  <p>Actually my problem is when i pass mobile as string as following code</p>
  
  <pre><code>     List&lt;UserDO&gt; userDOs = jd.query(SELECT_MOBILE_NUMBER, new Object[] { "2222222222" }, new RowMapper&lt;UserDO&gt;(){
  ......
  ......
  }
  }
  </code></pre>
  
  <p>it's working fine,its giving expected output.But when i pass as "mobileNumbers" instead of "2222222222" its not giving expected output.Any one explain me,can we pass array list object in jdbc Template Query().If so how can we pass? </p>
  
  <p>Thanks in advance</p>