# HG changeset patch # User Ingo Weinzierl # Date 1337065591 0 # Node ID 28526b0b0a900f27fd38a719f5c86a6bf8136069 # Parent e29781310140dbaa1992a062d29cbcb69bfbf8c6 Added DischargeZone.getDischargeZones() that returns all DischargeZones for a given river. flys-backend/trunk@4405 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r e29781310140 -r 28526b0b0a90 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Thu May 10 11:52:37 2012 +0000 +++ b/flys-backend/ChangeLog Tue May 15 07:06:31 2012 +0000 @@ -1,3 +1,9 @@ +2012-05-15 Ingo Weinzierl + + * src/main/java/de/intevation/flys/model/DischargeZone.java: Added a + function getDischargeZones() that returns all DischargeZones for a given + river. + 2012-05-10 Ingo Weinzierl * contrib/shpimporter/gauges.py: Search for field 'MPNAAM' and use its diff -r e29781310140 -r 28526b0b0a90 flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java --- a/flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java Thu May 10 11:52:37 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/DischargeZone.java Tue May 15 07:06:31 2012 +0000 @@ -2,6 +2,7 @@ import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; import javax.persistence.Entity; import javax.persistence.Id; @@ -13,8 +14,13 @@ import javax.persistence.JoinColumn; import javax.persistence.OneToOne; +import org.hibernate.Session; +import org.hibernate.Query; + import org.apache.log4j.Logger; +import de.intevation.flys.backend.SessionHolder; + @Entity @Table(name = "discharge_zone") @@ -116,5 +122,17 @@ public void setUpperDischarge(String upperDischarge) { this.upperDischarge = upperDischarge; } + + + public static List getDischargeZones(River river) { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from DischargeZone where river=:river"); + + query.setParameter("river", river); + + return query.list(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :