From 7519f4d04ba18cf5bff196590ef0c4c42ad468f3 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Tue, 8 Jul 2014 09:09:55 +0200 Subject: [PATCH] =?UTF-8?q?Opraveny=20chyby=20v=20agend=C4=9B=20St=C5=99ed?= =?UTF-8?q?iska/komise.=20refs=20#97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java | 7 ++++++- .../info/bukova/isspst/ui/workgroups/WorkgroupForm.java | 2 +- src/main/webapp/admin/workgroups/workgroups.zul | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java b/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java index 7f5f46d8..e9015f13 100644 --- a/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java +++ b/src/main/java/info/bukova/isspst/dao/jpa/BaseDaoJPA.java @@ -40,7 +40,12 @@ public abstract class BaseDaoJPA implements BaseDao { @Override public void delete(T entity) { - sessionFactory.getCurrentSession().delete(entity); + try { + sessionFactory.getCurrentSession().delete(entity); + } catch (NonUniqueObjectException e) { + Object o = sessionFactory.getCurrentSession().merge(entity); + sessionFactory.getCurrentSession().delete(o); + } } @Override diff --git a/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java b/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java index 7dac28db..c21fc7cc 100644 --- a/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java +++ b/src/main/java/info/bukova/isspst/ui/workgroups/WorkgroupForm.java @@ -124,7 +124,7 @@ public class WorkgroupForm extends FormViewModel { return; } - getDataBean().removeMember(u); + workgroupService.removeMember(getDataBean(), u); if (!target.equals("users")) { moveUser(u.getMember(), event); diff --git a/src/main/webapp/admin/workgroups/workgroups.zul b/src/main/webapp/admin/workgroups/workgroups.zul index f8cf63fe..1826fcda 100644 --- a/src/main/webapp/admin/workgroups/workgroups.zul +++ b/src/main/webapp/admin/workgroups/workgroups.zul @@ -67,7 +67,7 @@