changeset 777:e3f4f3585cce

Fixed PersistenceException in PUT status.
author Raimund Renkert <raimund.renkert@intevation.de>
date Thu, 12 Nov 2015 13:28:08 +0100
parents b55f517124e5
children 574391f1d88f
files src/main/java/de/intevation/lada/rest/MessungService.java src/main/java/de/intevation/lada/rest/StatusService.java
diffstat 2 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/rest/MessungService.java	Thu Nov 12 12:20:12 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/MessungService.java	Thu Nov 12 13:28:08 2015 +0100
@@ -248,7 +248,6 @@
         status.setMessungsId(((LMessung)created.getData()).getId());
         LProbe probe =
             defaultRepo.getByIdPlain(LProbe.class, ret.getProbeId(), "land");
-        //TODO set the correct value. use the probe to get the "erzeuger"!?
         status.setErzeuger(probe.getMstId());
         status.setStatusStufe(1);
         status.setStatusWert(0);
@@ -337,7 +336,6 @@
      *
      * @return Response object.
      */
-    @SuppressWarnings("unchecked")
     @DELETE
     @Path("/{id}")
     @Produces(MediaType.APPLICATION_JSON)
--- a/src/main/java/de/intevation/lada/rest/StatusService.java	Thu Nov 12 12:20:12 2015 +0100
+++ b/src/main/java/de/intevation/lada/rest/StatusService.java	Thu Nov 12 13:28:08 2015 +0100
@@ -284,7 +284,14 @@
         }
         LMessung messung = defaultRepo.getByIdPlain(
             LMessung.class, status.getMessungsId(), "land");
-        Response response = defaultRepo.create(status, "land");
+        LStatusProtokoll statusNew = new LStatusProtokoll();
+        statusNew.setDatum(status.getDatum());
+        statusNew.setErzeuger(status.getErzeuger());
+        statusNew.setMessungsId(status.getMessungsId());
+        statusNew.setStatusStufe(status.getStatusStufe());
+        statusNew.setStatusWert(status.getStatusWert());
+        statusNew.setText(status.getText());
+        Response response = defaultRepo.create(statusNew, "land");
         LStatusProtokoll created = (LStatusProtokoll)response.getData();
         messung.setStatus(created.getId());
         defaultRepo.update(messung, "land");
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)