diff --git a/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java b/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java index 4c9edbb2e3d..81c2b4aa4ff 100644 --- a/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java +++ b/Kitodo/src/main/java/org/kitodo/production/services/data/ProjectService.java @@ -367,6 +367,10 @@ public static void delete(int projectID) throws DAOException, DataException, Pro user.getProjects().remove(project); ServiceManager.getUserService().saveToDatabase(user); } + for (Template template : project.getTemplates()) { + template.getProjects().remove(project); + ServiceManager.getTemplateService().saveToDatabase(template); + } ServiceManager.getProjectService().remove(project); } }