title: custom item writer to write to database using list of list which contains hashmap
body: <p>i am a new to spring batch and my requirement is to read a dynamic excel sheet and insert into database.I am able to read excel and pass it to writer but only last record in excel sheet gets inserted into database. Here is my code for item writer</p>
  
  <pre><code>@Bean
  public ItemWriter&lt;List&lt;LinkedHashMap&lt;String, String&gt;&gt;&gt; tempwrite() {
  
   JdbcBatchItemWriter&lt;List&lt;LinkedHashMap&lt;String, String&gt;&gt;&gt; databaseItemWriter = new JdbcBatchItemWriter&lt;&gt;();
      databaseItemWriter.setDataSource(dataSource);
  
      databaseItemWriter.setSql("insert into table values(next value for seq_table,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
  
      ItemPreparedStatementSetter&lt;List&lt;LinkedHashMap&lt;String, String&gt;&gt;&gt; valueSetter = 
              new databasePsSetter();
  
  
  
      databaseItemWriter.setItemPreparedStatementSetter(valueSetter);
  
      return databaseItemWriter;
  }
  </code></pre>
  
  <p>and below is my prepared statement setter class</p>
  
  <pre><code>public class databasePsSetter implements ItemPreparedStatementSetter&lt;List&lt;LinkedHashMap&lt;String, String&gt;&gt;&gt; {
  
      @Override
      public void setValues(List&lt;LinkedHashMap&lt;String, String&gt;&gt; item, PreparedStatement ps) throws SQLException {
  
  
          int columnNumber=1;
  
          for(LinkedHashMap&lt;String, String&gt; row:item){
              columnNumber=1;
              for (Map.Entry&lt;String, String&gt; entry : row.entrySet()) {
  
                  ps.setString(columnNumber, entry.getValue());
                  columnNumber++;
  
              }
  
          }
  
  
      }
  
  }
  </code></pre>
  
  <p>I have seen many examples but all of them is using a dto class but i am not sure whether this is the correct way of implementation for list of list which contains hashmap</p>