diff backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java @ 8691:bfca77cbf353

(issue1750) There can be only one SQ-relation of a parameter for a time range (given by sq_relation_id) per station and some other attributes might be null.
author Tom Gottfried <tom@intevation.de>
date Fri, 17 Apr 2015 14:55:42 +0200
parents 17db08570637
children 5e38e2924c07
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java	Fri Apr 17 14:50:08 2015 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportSQRelationValue.java	Fri Apr 17 14:55:42 2015 +0200
@@ -77,29 +77,17 @@
     public SQRelationValue getPeer(SQRelation owner) {
         if (peer == null) {
             Session session = ImporterSession.getInstance().getDatabaseSession();
-            Query query2 = session.createQuery(
+            Query query = session.createQuery(
                 "from SQRelationValue " +
                 "   where sqRelation=:owner " +
-                "   and parameter=:parameter" +
                 "   and measurementStation=:measurementStation" +
-                "   and a=:a" +
-                "   and b=:b" +
-                "   and qMax=:qMax" +
-                "   and rSQ=:rSQ" +
-                "   and cFerguson=:cFerguson" +
-                "   and cDuan=:cDuan");
+                "   and parameter=:parameter");
 
-            query2.setParameter("owner", owner);
-            query2.setString("parameter", parameter);
-            query2.setParameter("measurementStation", station);
-            query2.setBigDecimal("a", toBigDecimal(a));
-            query2.setBigDecimal("b", toBigDecimal(b));
-            query2.setBigDecimal("qMax", toBigDecimal(qMax));
-            query2.setBigDecimal("rSQ", toBigDecimal(rSQ));
-            query2.setBigDecimal("cFerguson", toBigDecimal(cFerguson));
-            query2.setBigDecimal("cDuan", toBigDecimal(cDuan));
+            query.setParameter("owner", owner);
+            query.setParameter("measurementStation", station);
+            query.setString("parameter", parameter);
 
-            List<SQRelationValue> values = query2.list();
+            List<SQRelationValue> values = query.list();
 
             if (values.isEmpty()) {
                 peer = new SQRelationValue(

http://dive4elements.wald.intevation.org