Spring Batch saves information related to batch operations in your application in two different ways:
- Relational Database
- Volatile (in-memory map)
Storing these details allows Spring Batch to track statuses of job executions. Also the various readers and writers are stateful in nature; this necessitates persisting these meta-data in some form so that they can be used by Spring Batch to do the appropriate operations as required.
The Spring Batch Meta-Data tables very closely match the Domain objects that represent them in Java. The one-to-one relationship between the domain object and the table is as shown in Table 23-3 below.
Table 23-3. Domain object name and database table mapping in Spring Batch
|Domain Object||Database Table|
The JobRepository is responsible for saving and storing each Java object into its correct database table. JobRepository is purely an internal interface which the users need not know at all. But this has to be defined in the Spring configuration file as show in Listing 23-29 below.
Listing 23-29. JobRepository declaration in Spring configuration file using Spring Batch namespace
Figure 23-17 below shows how the various Spring Batch meta-data is filled in so that the database tables are filled with details required.
Figure 23-17. Spring Batch meta-data details getting filled in by Spring Batch
Figure 23-18 below shows the relationship between various database tables in Spring Batch which will be used by the various components to become stateful in nature.
Figure 23-18. Spring Batch meta-data database table schema details (Spring Batch Documentation)
Page Visitors: 24109