Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JobRepository.deleteJobInstance() Fails with Foreign Key Constraint Violation if Job Executions have Step Executions #4382

Closed
Swiking94 opened this issue May 23, 2023 · 2 comments
Labels
for: backport-to-5.0.x Issues that will be back-ported to the 5.0.x line for: backport-to-5.1.x Issues that will be back-ported to the 5.1.x line has: minimal-example Bug reports that provide a minimal complete reproducible example in: core status: feedback-provided Issues for which the feedback requested from the reporter was provided type: bug
Milestone

Comments

@Swiking94
Copy link

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

  1. Create a new Job.
  2. Try to delete all Executions/Instances of this Job using deleteJobInstance
  3. Foreign Key Constraint Violation error occurs

Expected behavior
All objects are correctly deleted from the database using deleteJobInstance

Thanks in advance for the consideration

@Swiking94 Swiking94 added status: waiting-for-triage Issues that we did not analyse yet type: bug labels May 23, 2023
@fmbenhassine
Copy link
Contributor

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.

@fmbenhassine fmbenhassine added status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter and removed status: waiting-for-triage Issues that we did not analyse yet labels Jun 14, 2023
@Swiking94
Copy link
Author

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

@fmbenhassine fmbenhassine added has: minimal-example Bug reports that provide a minimal complete reproducible example status: feedback-provided Issues for which the feedback requested from the reporter was provided and removed status: waiting-for-reporter Issues for which we are waiting for feedback from the reporter labels Jul 7, 2023
@fmbenhassine fmbenhassine added this to the 5.2.0 milestone Feb 15, 2024
@fmbenhassine fmbenhassine added for: backport-to-5.0.x Issues that will be back-ported to the 5.0.x line for: backport-to-5.1.x Issues that will be back-ported to the 5.1.x line labels Feb 15, 2024
This was referenced Feb 15, 2024
@fmbenhassine fmbenhassine modified the milestones: 5.2.0, 5.2.0-M1 Sep 16, 2024
FBibonne pushed a commit to FBibonne/spring-batch that referenced this issue Feb 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: backport-to-5.0.x Issues that will be back-ported to the 5.0.x line for: backport-to-5.1.x Issues that will be back-ported to the 5.1.x line has: minimal-example Bug reports that provide a minimal complete reproducible example in: core status: feedback-provided Issues for which the feedback requested from the reporter was provided type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants