Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/BedHeightSingleValue.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 | f283212966e8 |
children | 3bca80af6918 |
comparison
equal
deleted
inserted
replaced
2872:bcfdaa3a5bfc | 2873:1894e0471eac |
---|---|
1 package de.intevation.flys.model; | 1 package de.intevation.flys.model; |
2 | |
3 import java.util.List; | |
2 | 4 |
3 import java.io.Serializable; | 5 import java.io.Serializable; |
4 import java.math.BigDecimal; | 6 import java.math.BigDecimal; |
5 | 7 |
6 import javax.persistence.Entity; | 8 import javax.persistence.Entity; |
12 import javax.persistence.GenerationType; | 14 import javax.persistence.GenerationType; |
13 import javax.persistence.JoinColumn; | 15 import javax.persistence.JoinColumn; |
14 import javax.persistence.OneToOne; | 16 import javax.persistence.OneToOne; |
15 | 17 |
16 import org.apache.log4j.Logger; | 18 import org.apache.log4j.Logger; |
19 | |
20 import org.hibernate.Session; | |
21 import org.hibernate.Query; | |
22 | |
23 import de.intevation.flys.backend.SessionHolder; | |
17 | 24 |
18 | 25 |
19 @Entity | 26 @Entity |
20 @Table(name = "bed_height_single_values") | 27 @Table(name = "bed_height_single_values") |
21 public class BedHeightSingleValue | 28 public class BedHeightSingleValue |
135 } | 142 } |
136 | 143 |
137 public void setWidth(BigDecimal width) { | 144 public void setWidth(BigDecimal width) { |
138 this.width = width; | 145 this.width = width; |
139 } | 146 } |
147 | |
148 | |
149 public static List<BedHeightSingleValue> getBedHeightEpochValues( | |
150 BedHeightSingle single, | |
151 double kmLo, | |
152 double kmHi | |
153 ) { | |
154 Session session = SessionHolder.HOLDER.get(); | |
155 | |
156 Query query = session.createQuery( | |
157 "from BedHeightSingleValue where bedHeight=:single " + | |
158 " and station >= :kmLo and station <= :kmHi"); | |
159 | |
160 query.setParameter("single", single); | |
161 query.setParameter("kmLo", new BigDecimal(kmLo)); | |
162 query.setParameter("kmHi", new BigDecimal(kmHi)); | |
163 | |
164 return query.list(); | |
165 } | |
140 } | 166 } |
141 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 167 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |