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

The following examples show how to use org.springframework.batch.item.database.builder.JdbcBatchItemWriterBuilder. 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
Source File: BatchConfiguration.java    From batch-processing-large-datasets-spring with MIT License 5 votes vote down vote up
@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
Source File: BatchConfig.java    From Software-Architecture-with-Spring-5.0 with MIT License 5 votes vote down vote up
@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 File: BatchConfiguration.java    From messaging with 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();
}