[Lada-commits] [PATCH] Fixed PersistenceException in PUT status

Wald Commits scm-commit at wald.intevation.org
Thu Nov 12 13:28:12 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1447331288 -3600
# Node ID e3f4f3585ccea51749b49f9b8632cfd9692a2ef2
# Parent  b55f517124e56d21390d3892d34c717800c13e3c
Fixed PersistenceException in PUT status.

diff -r b55f517124e5 -r e3f4f3585cce src/main/java/de/intevation/lada/rest/MessungService.java
--- 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)
diff -r b55f517124e5 -r e3f4f3585cce src/main/java/de/intevation/lada/rest/StatusService.java
--- 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");


More information about the Lada-commits mailing list