changeset 1019:e192feaf916f

Introduce default value vor Messregime in Messprogramm.
author Tom Gottfried <tom@intevation.de>
date Tue, 05 Jul 2016 18:24:55 +0200
parents ce1ec3cbde54
children a796e68da1cf
files db_schema/lada_schema.sql src/main/java/de/intevation/lada/model/land/Messprogramm.java
diffstat 2 files changed, 10 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/db_schema/lada_schema.sql	Fri Jul 01 17:36:06 2016 +0200
+++ b/db_schema/lada_schema.sql	Tue Jul 05 18:24:55 2016 +0200
@@ -573,7 +573,7 @@
     labor_mst_id character varying(5) NOT NULL
         REFERENCES stammdaten.mess_stelle,
     datenbasis_id integer NOT NULL REFERENCES stammdaten.datenbasis,
-    ba_id integer,
+    ba_id integer DEFAULT 1,
     gem_id character varying(8),
     ort_id integer NOT NULL REFERENCES stammdaten.ort,
     media_desk character varying(100),
--- a/src/main/java/de/intevation/lada/model/land/Messprogramm.java	Fri Jul 01 17:36:06 2016 +0200
+++ b/src/main/java/de/intevation/lada/model/land/Messprogramm.java	Tue Jul 05 18:24:55 2016 +0200
@@ -16,6 +16,7 @@
 import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.Table;
+import javax.persistence.PrePersist;
 
 
 /**
@@ -26,6 +27,14 @@
 public class Messprogramm implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    // Has to be kept in sync with database schema
+    @PrePersist
+    void setDefaults() {
+        if (baId == null) {
+            baId = 1;
+        }
+    }
+
     @Id
     @GeneratedValue(strategy=GenerationType.IDENTITY)
     @Column(name="id", unique=true, nullable=false)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)