[Dive4elements-commits] [PATCH 2 of 5] Add getBuildings method that filters by kind

Wald Commits scm-commit at wald.intevation.org
Mon Mar 25 15:39:17 CET 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1364220025 -3600
# Node ID 1564ca2cb224f64834500202363ba5871ce0ca69
# Parent  ff11b178f152fe0fbad5a329cf70e8eb5964e854
Add getBuildings method that filters by kind

diff -r ff11b178f152 -r 1564ca2cb224 flys-backend/src/main/java/de/intevation/flys/model/Building.java
--- a/flys-backend/src/main/java/de/intevation/flys/model/Building.java	Mon Mar 25 12:19:40 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/model/Building.java	Mon Mar 25 15:00:25 2013 +0100
@@ -79,6 +79,16 @@
         this.geom = geom;
     }
 
+    public static List<Building> getBuildings(int riverId, int kindId) {
+        Session session = SessionHolder.HOLDER.get();
+
+        Query query = session.createQuery(
+            "from Building where river.id =:river_id and kind_id=:kind_id");
+        query.setParameter("kind_id", kindId);
+        query.setParameter("river_id", riverId);
+
+        return query.list();
+    }
 
     public static List<Building> getBuildings(int riverId, String name) {
         Session session = SessionHolder.HOLDER.get();


More information about the Dive4elements-commits mailing list