[PATCH 16 of 19] SedimentDensityFactory: query densities by id only (not year)

Wald Commits scm-commit at wald.intevation.org
Mon Sep 30 17:30:41 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1380555491 -7200
# Node ID 8079e3ba31c99596ec074d0b911341050d2df550
# Parent  d6030c90b312f43aa165d926fc31db75de1a6876
SedimentDensityFactory: query densities by id only (not year).

diff -r d6030c90b312 -r 8079e3ba31c9 artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFactory.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFactory.java	Mon Sep 30 17:36:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/minfo/SedimentDensityFactory.java	Mon Sep 30 17:38:11 2013 +0200
@@ -46,7 +46,7 @@
         "       sdv.year AS year " +
         "   FROM sediment_density sd" +
         "       JOIN sediment_density_values sdv ON sd.id = sdv.sediment_density_id" +
-        "   WHERE sdv.year = :year AND sd.id = :id";
+        "   WHERE sd.id = :id";
 
     private SedimentDensityFactory() {}
 
@@ -107,17 +107,15 @@
     }
 
     public static SedimentDensity getSedimentDensityUncached(
-        int id,
-        int year
+        int id
     ) {
         log.debug("getSedimentDensityUncached id/year");
         Session session = SessionHolder.HOLDER.get();
-        SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_DENSITY)
+        SQLQuery sqlQuery = session.createSQLQuery(SQL_SELECT_DENSITY_BY_ID_YEAR)
             .addScalar("km", StandardBasicTypes.DOUBLE)
             .addScalar("density", StandardBasicTypes.DOUBLE)
             .addScalar("year", StandardBasicTypes.INTEGER);
         sqlQuery.setInteger("id", id);
-        sqlQuery.setInteger("year", year);
         List<Object[]> results = sqlQuery.list();
         SedimentDensity density = new SedimentDensity();
         for (Object[] row : results) {


More information about the Dive4elements-commits mailing list