code: public static void fillParameters(PreparedStatement stmt, List<Object> params) throws SQLException {
  
          int i = 1;
          for (Object param : params) {
              if (param instanceof String) {
                  stmt.setString(i, (String)param);
              } else if (param instanceof Integer) {
                  stmt.setInt(i, ((Integer)param).intValue());
              } else if (param instanceof Long) {
                  stmt.setLong(i, ((Long)param).longValue());
              } else {
                  throw new IllegalArgumentException();
              }
              i += 1;
          }
      }
docs: Fills a given prepared statement with parameters from a list of objects.<p>
  
  @param stmt the prepared statement
  @param params the parameter objects
  
  @throws SQLException if something goes wrong