spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

Migrating Spring Boot 2 (h2) to Spring Boot 3 (MySql) getting errors

Open garethmatthews-cc opened this issue 2 years ago • 1 comments

Migrated code from Spring Boot2 into Spring Boot 3 and getting the following Error when running BDD Tests.

All I have done is removed the EnableBatchProcessing annotation.

Caused by: org.springframework.dao.DuplicateKeyException: PreparedStatementCallback; SQL [INSERT INTO BATCH_STEP_EXECUTION(STEP_EXECUTION_ID, VERSION, STEP_NAME, JOB_EXECUTION_ID, START_TIME, END_TIME, STATUS, COMMIT_COUNT, READ_COUNT, FILTER_COUNT, WRITE_COUNT, EXIT_CODE, EXIT_MESSAGE, READ_SKIP_COUNT, WRITE_SKIP_COUNT, PROCESS_SKIP_COUNT, ROLLBACK_COUNT, LAST_UPDATED, CREATE_TIME) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ]; Duplicate entry '0' for key 'batch_step_execution.PRIMARY'

This seems to occur when the Step completes as if it should have updated the table rather than inserted. Is this correct or am i missing some config?

garethmatthews-cc avatar Oct 20 '23 13:10 garethmatthews-cc