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 413379b7312..32b2907a0d3 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 @@ -368,6 +368,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); } }