当前位置: 首页>>代码示例>>Java>>正文


Java JdbcBatchItemWriter.setSql方法代码示例

本文整理汇总了Java中org.springframework.batch.item.database.JdbcBatchItemWriter.setSql方法的典型用法代码示例。如果您正苦于以下问题:Java JdbcBatchItemWriter.setSql方法的具体用法?Java JdbcBatchItemWriter.setSql怎么用?Java JdbcBatchItemWriter.setSql使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.batch.item.database.JdbcBatchItemWriter的用法示例。


在下文中一共展示了JdbcBatchItemWriter.setSql方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: customerItemWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
@StepScope
public JdbcBatchItemWriter<Customer> customerItemWriter() {
	JdbcBatchItemWriter<Customer> itemWriter = new JdbcBatchItemWriter<>();

	itemWriter.setDataSource(this.dataSource);
	itemWriter.setSql("INSERT INTO NEW_CUSTOMER VALUES (:id, :firstName, :lastName, :birthdate)");
	itemWriter.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider());
	itemWriter.afterPropertiesSet();

	return itemWriter;
}
 
开发者ID:mminella,项目名称:java-remote-partitioning,代码行数:13,代码来源:JobConfiguration.java

示例2: jdbcBatchItemWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
JdbcBatchItemWriter<Person> jdbcBatchItemWriter(DataSource h2) {
    JdbcBatchItemWriter<Person> w = new JdbcBatchItemWriter<>();
    w.setDataSource(h2);
    w.setSql("insert into PEOPLE( first, last, email) values ( :first, :last, :email )");
    w.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<>());
    return w;
}
 
开发者ID:livelessons-spring,项目名称:building-microservices,代码行数:9,代码来源:BatchConfiguration.java

示例3: jdbcBatchItemWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
public JdbcBatchItemWriter<Item> jdbcBatchItemWriter(){
	JdbcBatchItemWriter<Item> itemWriter = new JdbcBatchItemWriter<Item>();
	itemWriter.setSql("INSERT INTO ITEM (ID, DESCRIPTION) VALUES (:id,:description)");
	itemWriter.setDataSource(dataSource);
	itemWriter.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<Item>());
	return itemWriter;
}
 
开发者ID:codecentric,项目名称:spring-boot-starter-batch-web,代码行数:9,代码来源:FlatFileToDbSkipReaderTransactionalJobConfiguration.java

示例4: writer

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean(name = readCsvFileIntoTableStepWriter)
public JdbcBatchItemWriter<Customer> writer(DataSource dataSource) throws Exception {
    JdbcBatchItemWriter<Customer> jdbcBatchItemWriter = new JdbcBatchItemWriter<Customer>();
    jdbcBatchItemWriter.setAssertUpdates(true);
    jdbcBatchItemWriter.setDataSource(dataSource);
    jdbcBatchItemWriter.setSql(" INSERT INTO customer( first_name, last_name) VALUES ( :firstName , :lastName ) ");
    jdbcBatchItemWriter.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<Customer>());
    return jdbcBatchItemWriter;
}
 
开发者ID:joshlong,项目名称:javaconfig-ftw,代码行数:10,代码来源:BatchConfiguration.java

示例5: productItemWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
public ItemWriter<Product> productItemWriter() {
	JdbcBatchItemWriter<Product> itemWriter = new JdbcBatchItemWriter<Product>();
	itemWriter.setDataSource(dataSource);
	itemWriter.setSql("insert into product (id, name, description, price) values(?,?,?,?)");
	itemWriter.setItemPreparedStatementSetter(new ProductPrepareStatementSetter());
	itemWriter.afterPropertiesSet();

	return itemWriter;
}
 
开发者ID:debop,项目名称:spring-batch-experiments,代码行数:11,代码来源:JobStructureConfiguration.java

示例6: dbWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
public ItemWriter<Person> dbWriter() {
    JdbcBatchItemWriter<Person> writer = new JdbcBatchItemWriter<>();
    writer.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<Person>());
    writer.setSql("INSERT INTO person (login, passwd, age) VALUES (:login,:passwd,:age)");
    writer.setDataSource(dataSource);
    return writer;
}
 
开发者ID:przodownikR1,项目名称:springBatchBootJavaConfigkata,代码行数:9,代码来源:File2DbJob.java

示例7: jdbcWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
ItemWriter<Map<String, Object>> jdbcWriter(@Qualifier("exportDataSource") DataSource exportDataSource) {
	JdbcBatchItemWriter<Map<String, Object>> writer = new JdbcBatchItemWriter<>();
	writer.setDataSource(exportDataSource);
	writer.setSql("INSERT INTO twitter_influencers (user_name, followers) VALUES (:user_name, :followers)");
	return writer;
}
 
开发者ID:trisberg,项目名称:springone-2015,代码行数:8,代码来源:BatchHive2Configuration.java

示例8: jdbcBatchItemWriter

import org.springframework.batch.item.database.JdbcBatchItemWriter; //导入方法依赖的package包/类
@Bean
public JdbcBatchItemWriter<Item> jdbcBatchItemWriter(){
	JdbcBatchItemWriter<Item> itemWriter = new JdbcBatchItemWriter<Item>();
	itemWriter.setSql("INSERT INTO ITEM (ID, DESCRIPTION, FIRST_ACTION, SECOND_ACTION) VALUES (:id,:description,:firstAction,:secondAction)");
	itemWriter.setDataSource(dataSource);
	itemWriter.setItemSqlParameterSourceProvider(new BeanPropertyItemSqlParameterSourceProvider<Item>());
	return itemWriter;
}
 
开发者ID:codecentric,项目名称:spring-boot-starter-batch-web,代码行数:9,代码来源:FlatFileToDbNoSkipJobConfiguration.java


注:本文中的org.springframework.batch.item.database.JdbcBatchItemWriter.setSql方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。