Mercurial > dive4elements > river
comparison 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 |
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_epoch_values") | 27 @Table(name = "bed_height_epoch_values") |
21 public class BedHeightEpochValue | 28 public class BedHeightEpochValue |
87 } | 94 } |
88 | 95 |
89 public void setHeight(BigDecimal height) { | 96 public void setHeight(BigDecimal height) { |
90 this.height = height; | 97 this.height = height; |
91 } | 98 } |
99 | |
100 | |
101 public static List<BedHeightEpochValue> getBedHeightEpochValues( | |
102 BedHeightEpoch epoch, | |
103 double kmLo, | |
104 double kmHi | |
105 ) { | |
106 Session session = SessionHolder.HOLDER.get(); | |
107 | |
108 Query query = session.createQuery( | |
109 "from BedHeightEpochValue where bedHeight=:epoch " + | |
110 " and station >= :kmLo and station <= :kmHi"); | |
111 | |
112 query.setParameter("epoch", epoch); | |
113 query.setParameter("kmLo", new BigDecimal(kmLo)); | |
114 query.setParameter("kmHi", new BigDecimal(kmHi)); | |
115 | |
116 return query.list(); | |
117 } | |
92 } | 118 } |
93 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 119 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |