dont delete domainoptions if no new value is given

This commit is contained in:
Peter Hormanns 2012-07-25 15:37:12 +00:00
parent 3dd8a09e9e
commit 2171a5cf82

View File

@ -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<DomainOption> 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) {