title: Parsing excel sheet to database in java - passing arguments issue
body: <p>I am reading data from excel table and using java trying to set those values into database. My excel table has 6 columns and 170 rows. I have made class ExcelDataModel and mathod in which I go through excell table, but now I am stuck on how to pass arguments to BatchPreparedStatement. This is my code:</p>
  
  <pre><code>@Override
  public void getExcell2() {
       final String PATH = "C:\\Workspace\\zaposlenici.xlsx";         
       try {
          Workbook workbook = WorkbookFactory.create(new File(PATH));             
          Sheet sh = workbook.getSheetAt(0);                                              
          Iterator&lt;Row&gt; rowIterator = sh.iterator();              
          while (rowIterator.hasNext()) {
              Row row = rowIterator.next();                                               
              Iterator&lt;Cell&gt; cellIterator = row.cellIterator();
              while (cellIterator.hasNext()) {
                  Cell cell = cellIterator.next();
                  //how to pass arguments from one row to preparedStatement?
  
                  jdbcTemplate.batchUpdate("INSERT INTO INS_RAZNO.ZAPOSLENICI_TEST VALUES (?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
                      @Override                                   
                      public void setValues(PreparedStatement ps, int i) throws SQLException {
                          ExcelDataModel ex = new ExcelDataModel();
                          ps.setString(1, ex.getIme());
                          ps.setString(2, ex.getPrezime());           
                          ps.setString(3, ex.getOdjel());     
                          ps.setString(4, ex.getSlozenostPosla());            
                          ps.setString(5, ex.getStarost());       
                          ps.setString(6, ex.getMjesecniOD());    
                      }
                      @Override
                      public int getBatchSize() {
                          return 0;       
                      }
                  });
  
               }}
  
  
          } catch (EncryptedDocumentException | InvalidFormatException | IOException e) {
          e.printStackTrace();
          }
       }
  </code></pre>
  
  <p>And here is my ExcelDataModel code:</p>
  
  <pre><code>public class ExcelDataModel {
  
  private String ime;
  private String prezime;
  private String odjel;
  private String slozenostPosla;
  private String starost;
  private String mjesecniOD;
  
  public String getIme() {
      return ime;
  }
  
  public void setIme(String ime) {
      this.ime = ime;
  }
  
  public String getPrezime() {
      return prezime;
  }
  
  public void setPrezime(String prezime) {
      this.prezime = prezime;
  }
  
  public String getOdjel() {
      return odjel;
  }
  
  public void setOdjel(String odjel) {
      this.odjel = odjel;
  }
  
  public String getSlozenostPosla() {
      return slozenostPosla;
  }
  
  public void setSlozenostPosla(String slozenostPosla) {
      this.slozenostPosla = slozenostPosla;
  }
  
  public String getStarost() {
      return starost;
  }
  
  public void setStarost(String starost) {
      this.starost = starost;
  }
  
  public String getMjesecniOD() {
      return mjesecniOD;
  }
  
  public void setMjesecniOD(String mjesecniOD) {
      this.mjesecniOD = mjesecniOD;
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I dont know how to pass those arguments into preparedStatement. Basicaly, how to form data to become arguments?
  Any ideas? Thank you!</p>