diff src/main/java/de/intevation/lada/rest/MessungService.java @ 1034:61354a9fa58d schema-update

Make dynamic inserts on probe and messung objects to avoid 'not null'-constraint error.
author Raimund Renkert <raimund.renkert@intevation.de>
date Wed, 31 Aug 2016 15:50:54 +0200
parents 1c41c7b8f7c2
children f92c96efa976
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/MessungService.java	Wed Aug 31 15:49:40 2016 +0200
+++ b/src/main/java/de/intevation/lada/rest/MessungService.java	Wed Aug 31 15:50:54 2016 +0200
@@ -293,6 +293,7 @@
         /* Persist the new messung object*/
         Response response = repository.create(messung, "land");
         Messung ret = (Messung)response.getData();
+        Messung refreshed = repository.getByIdPlain(Messung.class, ret.getId(), "land");
         if(violation.hasWarnings()) {
             response.setWarnings(violation.getWarnings());
         }
@@ -305,10 +306,10 @@
         status.setMstId(probe.getMstId());
         status.setStatusKombi(1);
         repository.create(status, "land");
-        ret.setStatus(status.getId());
-        repository.update(ret, "land");
+        refreshed.setStatus(status.getId());
+        repository.update(refreshed, "land");
         Response updated=
-            repository.getById(Messung.class, ret.getId(), "land");
+            repository.getById(Messung.class, refreshed.getId(), "land");
 
         return authorization.filter(
             request,
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)