changeset 193:31c48d54f09d

Add forgotten column river_id in Gauges. flys-backend/trunk@1531 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 21 Mar 2011 10:41:47 +0000
parents f1fce41347ea
children 0f0b98ef9b04
files flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java flys-backend/src/main/java/de/intevation/flys/model/Gauge.java
diffstat 3 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/ChangeLog	Mon Mar 21 10:27:14 2011 +0000
+++ b/flys-backend/ChangeLog	Mon Mar 21 10:41:47 2011 +0000
@@ -1,3 +1,11 @@
+2011-03-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
+
+	* src/main/java/de/intevation/flys/model/Gauge.java:
+	  Add forgotten column river_id.
+
+	* src/main/java/de/intevation/flys/importer/ImportGauge.java:
+	  Small HQL fix.
+
 2011-03-21	Sascha L. Teichmann	<sascha.teichmann@intevation.de>
 
 	* src/main/java/de/intevation/flys/model/Gauge.java:
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java	Mon Mar 21 10:27:14 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportGauge.java	Mon Mar 21 10:41:47 2011 +0000
@@ -104,9 +104,9 @@
             Session session = Importer.sessionHolder.get();
             Query query = session.createQuery(
                 "from Gauge where name=:name " +
-                "and river.id=:id");
+                "and river.id=:river");
             query.setString("name", name);
-            query.setInteger("id", river.getId());
+            query.setParameter("river", river.getId());
             List<Gauge> gauges = query.list();
             if (gauges.isEmpty()) {
                 peer = new Gauge(
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Mon Mar 21 10:27:14 2011 +0000
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java	Mon Mar 21 10:41:47 2011 +0000
@@ -63,6 +63,16 @@
         this.id = id;
     }
 
+    @OneToOne
+    @JoinColumn(name = "river_id" )
+    public River getRiver() {
+        return river;
+    }
+
+    public void setRiver(River river) {
+        this.river = river;
+    }
+
     @Column(name = "name")
     public String getName() {
         return name;

http://dive4elements.wald.intevation.org