changeset 456:dbeb56e913fd

Updated Messung and MessungTranslation model.
author Raimund Renkert <raimund.renkert@intevation.de>
date Mon, 16 Feb 2015 15:13:08 +0100
parents 01d6da858394
children 51784d74a85b
files src/main/java/de/intevation/lada/model/Messung.java src/main/java/de/intevation/lada/model/land/LMessung.java src/main/java/de/intevation/lada/model/land/MessungTranslation.java
diffstat 3 files changed, 42 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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;
--- 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) {}
 }
--- 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;
-    }
-
 }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)