Mercurial > dive4elements > river
changeset 1257:85bcf8f34abb
Added a function to query a DGM by Id.
flys-backend/trunk@2781 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 16 Sep 2011 14:53:21 +0000 |
parents | 7141ff5540c9 |
children | 2bdbaf9b0cf7 8a3dbb705ebf |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/DGM.java |
diffstat | 2 files changed, 18 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Thu Sep 15 11:19:08 2011 +0000 +++ b/flys-backend/ChangeLog Fri Sep 16 14:53:21 2011 +0000 @@ -1,3 +1,8 @@ +2011-09-16 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/model/DGM.java: Added function to query + a DGM by Id. + 2011-09-15 Bjoern Schilberg <bjoern@intevation.de> * pom.xml: Removed oracle dependency.
--- a/flys-backend/src/main/java/de/intevation/flys/model/DGM.java Thu Sep 15 11:19:08 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/DGM.java Fri Sep 16 14:53:21 2011 +0000 @@ -83,6 +83,19 @@ } + public static DGM getDGM(int id) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from DGM where Id =:id"); + query.setParameter("id", id); + + List<DGM> result = query.list(); + + return result.isEmpty() ? null : result.get(0); + } + + public static DGM getDGM(String river, double lower, double upper) { Session session = SessionHolder.HOLDER.get();