Mercurial > dive4elements > river
changeset 1235:47ce1fab8464
Added a static function that returns all CrossSectionTracks of a specific river.
flys-backend/trunk@2611 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 30 Aug 2011 15:14:59 +0000 (2011-08-30) |
parents | c5c48f52dc7b |
children | 324cb486db9f |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java |
diffstat | 2 files changed, 23 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/flys-backend/ChangeLog Thu Aug 25 14:41:39 2011 +0000 +++ b/flys-backend/ChangeLog Tue Aug 30 15:14:59 2011 +0000 @@ -1,3 +1,8 @@ +2011-08-30 Ingo Weinzierl <ingo@intevation.de> + + * src/main/java/de/intevation/flys/model/CrossSectionTrack.java: New + static function to retrieve all CrossSectionTracks of a specific river. + 2011-08-25 Ingo Weinzierl <ingo@intevation.de> * src/main/java/de/intevation/flys/utils/FileTools.java: Moved to
--- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Thu Aug 25 14:41:39 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionTrack.java Tue Aug 30 15:14:59 2011 +0000 @@ -2,6 +2,7 @@ import java.io.Serializable; import java.math.BigDecimal; +import java.util.List; import javax.persistence.Column; import javax.persistence.Entity; @@ -10,10 +11,14 @@ import javax.persistence.OneToOne; import javax.persistence.Table; +import org.hibernate.Query; +import org.hibernate.Session; import org.hibernate.annotations.Type; import com.vividsolutions.jts.geom.LineString; +import de.intevation.flys.backend.SessionHolder; + @Entity @Table(name = "cross_section_tracks") @@ -86,5 +91,18 @@ public void setZ(BigDecimal z) { this.z = z; } + + + public static List<CrossSectionTrack> getCrossSectionTrack( + String river) + { + Session session = SessionHolder.HOLDER.get(); + + Query query = session.createQuery( + "from CrossSectionTrack where river.name =:river"); + query.setParameter("river", river); + + return query.list(); + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :