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 @@