diff --git a/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java b/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java index 8107229bd..42719653d 100644 --- a/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java +++ b/src/main/java/org/gridsuite/modification/server/repositories/NetworkModificationRepository.java @@ -244,7 +244,9 @@ public void deleteStashedModificationGroup(UUID groupUuid, boolean errorOnGroupN try { ModificationGroupEntity groupEntity = getModificationGroup(groupUuid); if (!groupEntity.getModifications().isEmpty()) { - modificationRepository.deleteAll(groupEntity.getModifications().stream().filter(modificationEntity -> modificationEntity.getStashed().equals(true)).collect(Collectors.toList())); + List stashedModifications = groupEntity.getModifications().stream() + .filter(modificationEntity -> modificationEntity.getStashed()).map(modification -> modification.getId()).collect(Collectors.toList()); + deleteModifications(groupUuid, stashedModifications); } } catch (NetworkModificationException e) { if (e.getType() == MODIFICATION_GROUP_NOT_FOUND && !errorOnGroupNotFound) {