Java Code Examples for org.springframework.batch.item.database.builder.JdbcBatchItemWriterBuilder

The following examples show how to use org.springframework.batch.item.database.builder.JdbcBatchItemWriterBuilder. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Bean
public JdbcBatchItemWriter<Voltage> writer(final DataSource dataSource) {
    return new JdbcBatchItemWriterBuilder<Voltage>()
            .itemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<>())
            .sql("INSERT INTO voltage (volt, time) VALUES (:volt, :time)")
            .dataSource(dataSource)
            .build();
}
 
Example 2
@Bean
public JdbcBatchItemWriter<PayrollTo> writer(DataSource dataSource) {
    return new JdbcBatchItemWriterBuilder<PayrollTo>()
            .itemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<>())
            .sql("INSERT INTO PAYROLL (PERSON_IDENTIFICATION, CURRENCY, TX_AMMOUNT, ACCOUNT_TYPE, ACCOUNT_ID, TX_DESCRIPTION, FIRST_LAST_NAME) VALUES (:identification,:currency,:ammount,:accountType, :accountNumber, :description, :firstLastName)")
            .dataSource(dataSource)
            .build();
}
 
Example 3
Source Project: messaging   Source File: BatchConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
JdbcBatchItemWriter<Contact> jdbcWriter(DataSource dataSource) {
 return new JdbcBatchItemWriterBuilder<Contact>()
  .dataSource(dataSource)
  .beanMapped()
  .sql(
   "insert into CONTACT( full_name, email, valid_email ) values ( :fullName, :email, :validEmail )")
  .build();
}