From 37419cba663a27e99e5b7f27e663dfbed4ba9e14 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Sat, 26 Jan 2013 00:52:05 -0300 Subject: [PATCH] Fix delete issue removing in hsql. History is now removed in advance. --- .../main/java/com/wisemapping/dao/MindmapManagerImpl.java | 7 +++++++ 1 file changed, 7 insertions(+) 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); }