Spring Batch Framework - Auto create Batch Table

后端 未结 9 1589
广开言路
广开言路 2020-12-01 12:02

I just created a batch job using Spring Batch framework, but I don\'t have Database privileges to run CREATE SQL. When I try to run the batch job I hit the error while the f

9条回答
  •  悲哀的现实
    2020-12-01 12:46

    Spring Batch required following tables to run job

    • BATCH_JOB_EXECUTION
    • BATCH_JOB_EXECUTION_CONTEXT
    • BATCH_JOB_EXECUTION_PARAMS
    • BATCH_JOB_EXECUTION_SEQ
    • BATCH_JOB_INSTANCE
    • BATCH_JOB_SEQ
    • BATCH_STEP_EXECUTION
    • BATCH_STEP_EXECUTION_CONTEXT
    • BATCH_STEP_EXECUTION_SEQ

    If you are using h2 db then it will create all required table by default

    • spring.h2.console.enabled=true
    • spring.datasource.url=jdbc:h2:mem:testdb
    • spring.datasource.driverClassName=org.h2.Driver
    • spring.datasource.username=sa
    • spring.datasource.password=
    • spring.jpa.database-platform=org.hibernate.dialect.H2Dialect

    When you start using Mysql or any other database you need to add follwing properties into application.properties

                   spring.batch.initialize-schema=always
    

提交回复
热议问题