diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java index adb9ba88..7b562f0b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/MindmapManagerImpl.java @@ -203,6 +203,13 @@ public class MindmapManagerImpl @Override public void removeMindmap(@NotNull final Mindmap mindMap) { + // Delete history first ... + final Criteria hibernateCriteria = getSession().createCriteria(MindMapHistory.class); + hibernateCriteria.add(Restrictions.eq("mindmapId", mindMap.getId())); + List list = hibernateCriteria.list(); + getHibernateTemplate().deleteAll(list); + + // Delete mindmap .... getHibernateTemplate().delete(mindMap); }