Mercurial > dive4elements > river
changeset 5465:c8e74e5e828c
Add crosssection track accessors that filter by kind and by kind and name
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 27 Mar 2013 15:26:28 +0100 |
parents | f2bcf0fb1efd |
children | ba1bf40a9787 |
files | flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java |
diffstat | 1 files changed, 35 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Wed Mar 27 11:29:59 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Wed Mar 27 15:26:28 2013 +0100 @@ -134,6 +134,41 @@ return query.list(); } + public static List<CrossSectionTrack> getCrossSectionTrack( + String river, + int kind_id + ) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from CrossSectionTrack as cst " + + " where river.name =:river" + + " and kind_id=:kind_id"); + query.setParameter("river", river); + query.setParameter("kind_id", kind_id); + + return query.list(); + } + + public static List<CrossSectionTrack> getCrossSectionTrack( + String river, + String name, + int kind_id + ) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from CrossSectionTrack as cst " + + " where river.name =:river" + + " and cst.name=:name" + + " and kind_id=:kind_id"); + query.setParameter("river", river); + query.setParameter("name", name); + query.setParameter("kind_id", kind_id); + + return query.list(); + } + /** * Returns the nearest CrossSectionTrack of <i>river</i> to a given