Skip to content

Instantly share code, notes, and snippets.

@Edijun
Created April 30, 2019 06:57
Show Gist options
  • Select an option

  • Save Edijun/15f7048c429d1b7138173c3e5d50f1fe to your computer and use it in GitHub Desktop.

Select an option

Save Edijun/15f7048c429d1b7138173c3e5d50f1fe to your computer and use it in GitHub Desktop.
@Bean
public JdbcBatchItemWriter<Product> csvProductWriter() {
JdbcBatchItemWriter<Product> csvProductWriter = new JdbcBatchItemWriter<Product>();
csvProductWriter.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<Product>());
csvProductWriter.setSql("INSERT INTO product (id, name, price, description) VALUES (:id, :name, :price, :description)");
csvProductWriter.setDataSource(dataSource);
return csvProductWriter;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment