[Lada-commits] [PATCH 1 of 6] Updated Messung and MessungTranslation model

Wald Commits scm-commit at wald.intevation.org
Mon Feb 16 15:24:58 CET 2015


# HG changeset patch
# User Raimund Renkert <raimund.renkert at intevation.de>
# Date 1424095988 -3600
# Node ID dbeb56e913fd9d620fa183aafc3a68e3fa2abc82
# Parent  01d6da858394a00ce6bf16143f839fc27cb2f988
Updated Messung and MessungTranslation model.

diff -r 01d6da858394 -r dbeb56e913fd src/main/java/de/intevation/lada/model/Messung.java
--- a/src/main/java/de/intevation/lada/model/Messung.java	Wed Feb 11 15:27:17 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/Messung.java	Mon Feb 16 15:13:08 2015 +0100
@@ -11,6 +11,8 @@
 import java.sql.Timestamp;
 
 import javax.persistence.Column;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
 import javax.persistence.Id;
 import javax.persistence.MappedSuperclass;
 import javax.persistence.Table;
@@ -25,6 +27,8 @@
     private static final long serialVersionUID = 1L;
 
     @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id", unique=true, nullable=false)
     private Integer id;
 
     private Boolean fertig;
diff -r 01d6da858394 -r dbeb56e913fd src/main/java/de/intevation/lada/model/land/LMessung.java
--- a/src/main/java/de/intevation/lada/model/land/LMessung.java	Wed Feb 11 15:27:17 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/land/LMessung.java	Mon Feb 16 15:13:08 2015 +0100
@@ -9,8 +9,11 @@
 
 import javax.persistence.Column;
 import javax.persistence.Entity;
+import javax.persistence.OneToOne;
 import javax.persistence.Table;
 
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
 import de.intevation.lada.model.Messung;
 
 
@@ -25,12 +28,14 @@
     @Column(name="nebenproben_nr")
     private String nebenprobenNr;
 
+    @OneToOne(mappedBy="messungs")
+    private MessungTranslation messungTranslation;
+
     private Boolean geplant;
 
     public LMessung() {
     }
 
-
     public Boolean getGeplant() {
         return this.geplant;
     }
@@ -46,4 +51,19 @@
     public void setNebenprobenNr(String nebenprobenNr) {
         this.nebenprobenNr = nebenprobenNr;
     }
+
+    @JsonIgnore
+    public MessungTranslation getMessungTranslation() {
+        return this.messungTranslation;
+    }
+
+    public void setMessungsTranslation(MessungTranslation messungTranslation) {
+        this.messungTranslation = messungTranslation;
+    }
+
+    public Integer getMessungsIdAlt() {
+        return this.messungTranslation.getMessungsIdAlt();
+    }
+
+    public void setMessungsIdAlt(Integer messungsIdAlt) {}
 }
diff -r 01d6da858394 -r dbeb56e913fd src/main/java/de/intevation/lada/model/land/MessungTranslation.java
--- a/src/main/java/de/intevation/lada/model/land/MessungTranslation.java	Wed Feb 11 15:27:17 2015 +0100
+++ b/src/main/java/de/intevation/lada/model/land/MessungTranslation.java	Mon Feb 16 15:13:08 2015 +0100
@@ -8,8 +8,14 @@
 package de.intevation.lada.model.land;
 
 import java.io.Serializable;
+
 import javax.persistence.*;
 
+import org.hibernate.annotations.Generated;
+import org.hibernate.annotations.GenerationTime;
+
+import com.fasterxml.jackson.annotation.JsonIgnore;
+
 
 /**
  * The persistent class for the messung_translation database table.
@@ -20,17 +26,17 @@
     private static final long serialVersionUID = 1L;
 
     @Id
+    @GeneratedValue(strategy=GenerationType.IDENTITY)
+    @Column(name="id", unique=true)
     private Integer id;
 
-    @Column(name="messungs_id")
-    private Integer messungsId;
+    @OneToOne
+    private LMessung messungs;
 
-    @Column(name="messungs_id_alt")
+    @Generated(GenerationTime.INSERT)
+    @Column(name="messungs_id_alt", insertable=false)
     private Integer messungsIdAlt;
 
-    @Column(name="probe_id_alt")
-    private String probeIdAlt;
-
     public MessungTranslation() {
     }
 
@@ -42,12 +48,13 @@
         this.id = id;
     }
 
-    public Integer getMessungsId() {
-        return this.messungsId;
+    @JsonIgnore
+    public LMessung getMessungsId() {
+        return this.messungs;
     }
 
-    public void setMessungsId(Integer messungsId) {
-        this.messungsId = messungsId;
+    public void setMessungsId(LMessung messung) {
+        this.messungs = messung;
     }
 
     public Integer getMessungsIdAlt() {
@@ -57,13 +64,4 @@
     public void setMessungsIdAlt(Integer messungsIdAlt) {
         this.messungsIdAlt = messungsIdAlt;
     }
-
-    public String getProbeIdAlt() {
-        return this.probeIdAlt;
-    }
-
-    public void setProbeIdAlt(String probeIdAlt) {
-        this.probeIdAlt = probeIdAlt;
-    }
-
 }


More information about the Lada-commits mailing list