Skip to content

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

Closed
@Swiking94

Description

@Swiking94

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: backport-to-5.0.xIssues that will be back-ported to the 5.0.x linefor: backport-to-5.1.xIssues that will be back-ported to the 5.1.x linehas: minimal-exampleBug reports that provide a minimal complete reproducible examplein: corestatus: feedback-providedIssues for which the feedback requested from the reporter was providedtype: bug

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions