[PATCH 5 of 9] issue1512: Added method to get FlowVelocityModel by id

Wald Commits scm-commit at wald.intevation.org
Fri Oct 11 12:05:17 CEST 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1381480226 -7200
# Node ID dd8103e8ee5bfb367396ce50dde2dfa87e91ef63
# Parent  8c315b6bbc8a619cb05f7d676475007c05ede708
issue1512: Added method to get FlowVelocityModel by id.

diff -r 8c315b6bbc8a -r dd8103e8ee5b backend/src/main/java/org/dive4elements/river/model/FlowVelocityModel.java
--- a/backend/src/main/java/org/dive4elements/river/model/FlowVelocityModel.java	Fri Oct 11 10:29:37 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/model/FlowVelocityModel.java	Fri Oct 11 10:30:26 2013 +0200
@@ -110,5 +110,17 @@
 
         return query.list();
     }
+
+    public static FlowVelocityModel getModel(int id) {
+
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from FlowVelocityModel where id=:id");
+
+        query.setParameter("id", id);
+
+        return (FlowVelocityModel) query.list().get(0);
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :


More information about the Dive4elements-commits mailing list