From 2171a5cf82f9a6469920a05f0941a4f93374394d Mon Sep 17 00:00:00 2001 From: Peter Hormanns Date: Wed, 25 Jul 2012 15:37:12 +0000 Subject: [PATCH] dont delete domainoptions if no new value is given --- hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java index 4b329e6..85c0066 100644 --- a/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java +++ b/hsarback/src/de/hsadmin/mods/dom/DomainModuleImpl.java @@ -3,6 +3,7 @@ package de.hsadmin.mods.dom; import java.util.Date; import java.util.LinkedList; import java.util.List; +import java.util.Set; import javax.persistence.EntityManager; import javax.persistence.Query; @@ -157,7 +158,11 @@ public class DomainModuleImpl extends AbstractModuleImpl { Query q = em.createQuery("SELECT opt FROM " + DomainOption.class.getAnnotation(javax.persistence.Entity.class).name() + " opt WHERE opt.name=:optName"); - for (DomainOption opt : updatedDom.getDomainOptions()) { + Set domainOptions = updatedDom.getDomainOptions(); + if (domainOptions == null) { + updatedDom.setDomainOptions(oldDom.getDomainOptions()); + } + for (DomainOption opt : domainOptions) { q.setParameter("optName", opt.getName()); List list = q.getResultList(); if (list.size() != 1) {