Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/model/BedHeightEpochValue.java @ 2873:1894e0471eac
Added functions to retrieve bed height single and epoch values based on its owner and km range.
flys-backend/trunk@4439 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Fri, 18 May 2012 11:30:26 +0000 |
parents | 04eeb45df27b |
children |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/BedHeightEpochValue.java Fri May 18 07:01:47 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/BedHeightEpochValue.java Fri May 18 11:30:26 2012 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.model; +import java.util.List; + import java.io.Serializable; import java.math.BigDecimal; @@ -15,6 +17,11 @@ import org.apache.log4j.Logger; +import org.hibernate.Session; +import org.hibernate.Query; + +import de.intevation.flys.backend.SessionHolder; + @Entity @Table(name = "bed_height_epoch_values") @@ -89,5 +96,24 @@ public void setHeight(BigDecimal height) { this.height = height; } + + + public static List<BedHeightEpochValue> getBedHeightEpochValues( + BedHeightEpoch epoch, + double kmLo, + double kmHi + ) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from BedHeightEpochValue where bedHeight=:epoch " + + " and station >= :kmLo and station <= :kmHi"); + + query.setParameter("epoch", epoch); + query.setParameter("kmLo", new BigDecimal(kmLo)); + query.setParameter("kmHi", new BigDecimal(kmHi)); + + return query.list(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :