ITZone

Spring Batch – Series – 2 – JobRepository

At this article I will create a JobRepository.

What is JobRepository?

1. Concepts.

  • CRUD in SQL:
    Operation SQL
    Create INSERT
    Read SELECT
    Update UPDATE
    Delete DELETE
  • JobRepository

    Repository responsible for persistence of batch meta-data entities.

    The task of storing and putting the object information into the correct installation of Spring Batch.

    Table Object
    BATCH_JOB_INSTANCE JobInstance
    BATCH_JOB_EXECUTION JobExecution
    BATCH_JOB_EXECUTION_PARAMS JobParameters
    BATCH_STEP_EXECUTION StepExecution
    BATCH_JOB_EXECUTION_CONTEXT ExecutionContext
    BATCH_STEP_EXECUTION_CONTEXT ExecutionContext

2. Create a demo project.

Visit spring initializr to create a project

  • Add the necessary libraries to the project:

  • Click:

3. Install resource.

  • In the application.properties file, perform config initialization tables.

  • Create a MySQL database connection class config

  • Create config for jobRepository

  • Perform a run once we get a system tables group of Spring Batch

4. Class Controller

  • Next create a class controller that sends a request url to execute creating a JobExecution

5. Check

  • Make a request “/ jobRepository”

  • Check if Job with “jobName” is registered.

  • Already signed the job’s params successfully.

So has successfully registered a Job through the jobRepository class.

What’s wrong with everyone’s suggestions.

Share the news now