[Lada-commits] [PATCH 2 of 2] Save a new ort object and set the field 'bezeichnung' with a generated value

Wald Commits scm-commit at wald.intevation.org
Thu Dec 5 09:55:25 CET 2013


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1386233713 -3600
# Node ID ab0307eccee8f142fad662595b89cf1038de75b8
# Parent  9d5e4d4eb90f62810dab8f69666dc3a4b6ca0bb2
Save a new ort object and set the field 'bezeichnung' with a generated value.

diff -r 9d5e4d4eb90f -r ab0307eccee8 src/main/java/de/intevation/lada/data/OrtRepository.java
--- a/src/main/java/de/intevation/lada/data/OrtRepository.java	Thu Dec 05 09:54:19 2013 +0100
+++ b/src/main/java/de/intevation/lada/data/OrtRepository.java	Thu Dec 05 09:55:13 2013 +0100
@@ -97,7 +97,10 @@
         }
         Ort ort = (Ort)object;
         try {
-            manager.create(ort);
+            manager.persist(ort);
+            int id = ort.getOrtId();
+            ort.setBezeichnung("D_ " + String.format("%05d", id));
+            manager.update(ort);
             return new Response(true, 200, ort);
         }
         catch(EntityExistsException eee) {


More information about the Lada-commits mailing list