Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/FlowVelocityModel.java @ 2871:5a89c2b05e6d
Added functions to retrieve data from database.
flys-backend/trunk@4409 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 15 May 2012 14:19:55 +0000 |
parents | a948366d8ac5 |
children | c7ce7c9e405e |
comparison
equal
deleted
inserted
replaced
2870:28526b0b0a90 | 2871:5a89c2b05e6d |
---|---|
11 import javax.persistence.SequenceGenerator; | 11 import javax.persistence.SequenceGenerator; |
12 import javax.persistence.GenerationType; | 12 import javax.persistence.GenerationType; |
13 import javax.persistence.JoinColumn; | 13 import javax.persistence.JoinColumn; |
14 import javax.persistence.OneToOne; | 14 import javax.persistence.OneToOne; |
15 | 15 |
16 import org.hibernate.Session; | |
17 import org.hibernate.Query; | |
18 | |
16 import org.apache.log4j.Logger; | 19 import org.apache.log4j.Logger; |
20 | |
21 import de.intevation.flys.backend.SessionHolder; | |
17 | 22 |
18 | 23 |
19 @Entity | 24 @Entity |
20 @Table(name = "flow_velocity_model") | 25 @Table(name = "flow_velocity_model") |
21 public class FlowVelocityModel | 26 public class FlowVelocityModel |
97 } | 102 } |
98 | 103 |
99 public void setDescription(String description) { | 104 public void setDescription(String description) { |
100 this.description = description; | 105 this.description = description; |
101 } | 106 } |
107 | |
108 | |
109 public static List<FlowVelocityModel> getModels( | |
110 River river, | |
111 DischargeZone zone | |
112 ) { | |
113 Session session = SessionHolder.HOLDER.get(); | |
114 | |
115 Query query = session.createQuery( | |
116 "from FlowVelocityModel where river=:river and dischargeZone=:zone"); | |
117 | |
118 query.setParameter("river", river); | |
119 query.setParameter("zone", zone); | |
120 | |
121 return query.list(); | |
122 } | |
102 } | 123 } |
103 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : | 124 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |