Description
Related to #4242
Bug description
Using the method deleteJobInstance
from JobRepository does not work if a JobExecution still has StepExecutions
Explications from my understanding
The work done in this commit works well: when you call JobRepository.findJobExecutions()
it returns the JobExecutions with all the StepExecutions
However when you call JobRepository.deleteJobInstance()
the method called for retrieving the JobExecutions is not JobRepository.findJobExecutions()
but this.jobExecutionDao.findJobExecutions(jobInstance)
thus resulting in the abscence of the StepExecutions in the JobExecutions
Environment
Spring Batch 5.0.1
Steps to reproduce
- Create a new Job.
- Try to delete all Executions/Instances of this Job using
deleteJobInstance
- Foreign Key Constraint Violation error occurs
Expected behavior
All objects are correctly deleted from the database using deleteJobInstance
Thanks in advance for the consideration
Activity
fmbenhassine commentedon Jun 14, 2023
Thank you for opening this issue! We do not exclude that this could be a bug in Spring Batch. However, we would like to validate that with a minimal complete verifiable example.
Could you please take some time to create a minimal example that reproduces the problem? To help you in reporting your issue, we have prepared a project template that you can use as a starting point. Please check the Issue Reporting Guidelines for more details about this.
Thank you for your collaboration.
Swiking94 commentedon Jul 6, 2023
Hi!
Thank you for your reply and consideration.
Here is the sample of reproduction
Please let me know if it is not enough or if you can't make it work
spring-batch-mcve.zip
Have a nice day
SimpleJobRepository#deleteJobInstance
delete corresponding step executions #4497Let SimpleJobRepository#deleteJobInstance delete corresponding step e…
Let SimpleJobRepository#deleteJobInstance delete corresponding step e…
Let SimpleJobRepository#deleteJobInstance delete corresponding step e…
Let SimpleJobRepository#deleteJobInstance delete corresponding step e…