From the course: Spring: Spring Batch
Unlock the full course today
Join today to access over 22,500 courses taught by industry experts or purchase this course individually.
Writing to a database with PreparedStatements
From the course: Spring: Spring Batch
Writing to a database with PreparedStatements
- [Instructor] Writing output to a database is another common requirement for batch jobs that is supported by spring batch. Spring batch provides several components for writing information from a batch job to a database. Supporting technologies such as Hibernate, Jdbc, Mongo, and JPA. In this lesson, we'll learn how to use JDC support by using the JDBC batch item writer to write information to our relational database. To get started using the JDBC batch item writer we're going to remove the FlatFileItemWriter configuration within our item writer method. Once we take out that configuration, we can start to configure our new item writer implementation the JDBC batch item writer. To do that, we can use a JdbcBatchItemWriterBuilder. The jdbcBatchItemWriterBuilder does require us to supply a generic argument which is the type of the pojo we would like to write. From there, we can then begin the configuration of our…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.