From the course: Spring: Spring Batch

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Reading from databases in multithreaded scenarios

Reading from databases in multithreaded scenarios

From the course: Spring: Spring Batch

Start my 1-month free trial

Reading from databases in multithreaded scenarios

- The JdbcPagingItemReader is another item reader implementation that is necessary when working in multi-threaded scenarios with a relational database. Its configuration is very similar to the JdbcCursorItemReade, aside from a small difference or two. Let's dive in and see the JdbcPagingItemReader in action. So to get started, we're going to switch the implementation of our item reader. And to do that, we need to change the builder that we're using to construct that item reader. Now, just like the JdbcCursorItemReade has a builder, so does the JdbcPagingItemReader. So we'll make that switch and go ahead and import the type. Now you'll notice that the interface on that builder is a little bit different. We're no longer supplying the SQL directly within the configuration of the item reader. Instead, we're going to use a query provider in order to construct our SQL statement. This is important because with the paging, it's…

Contents