diff flys-backend/src/main/java/de/intevation/flys/model/Building.java @ 5402:1564ca2cb224

Add getBuildings method that filters by kind
author Andre Heinecke <aheinecke@intevation.de>
date Mon, 25 Mar 2013 15:00:25 +0100
parents b6f94c5db89e
children
line wrap: on
line diff
--- 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();

http://dive4elements.wald.intevation.org