Fix object graph deletion in SimpleJobRepository#deleteJobExecution

Before this commit, SimpleJobRepository#deleteJobExecution
did not delete associated step executions as specified in the
contract of the method.

This commit fixes the implementation to delete the entire
object graph as specified.

Resolves #4249
This commit is contained in:
Mahmoud Ben Hassine
2023-02-20 07:40:28 +01:00
parent 4ea54388e7
commit 4629294b65
3 changed files with 31 additions and 10 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2006-2022 the original author or authors.
* Copyright 2006-2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -320,6 +320,9 @@ public class SimpleJobRepository implements JobRepository {
public void deleteJobExecution(JobExecution jobExecution) {
this.ecDao.deleteExecutionContext(jobExecution);
this.jobExecutionDao.deleteJobExecutionParameters(jobExecution);
for (StepExecution stepExecution : jobExecution.getStepExecutions()) {
deleteStepExecution(stepExecution);
}
this.jobExecutionDao.deleteJobExecution(jobExecution);
}