Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/model/FlowVelocityModel.java @ 5323:c7ce7c9e405e
Removed river dependency from flow velocity model.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 15 Mar 2013 18:19:07 +0100 |
parents | 5a89c2b05e6d |
children |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/model/FlowVelocityModel.java Fri Mar 15 17:19:16 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/model/FlowVelocityModel.java Fri Mar 15 18:19:07 2013 +0100 @@ -1,24 +1,25 @@ package de.intevation.flys.model; +import de.intevation.flys.backend.SessionHolder; + import java.io.Serializable; + import java.util.List; +import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.GeneratedValue; +import javax.persistence.GenerationType; import javax.persistence.Id; -import javax.persistence.Table; -import javax.persistence.GeneratedValue; -import javax.persistence.Column; -import javax.persistence.SequenceGenerator; -import javax.persistence.GenerationType; import javax.persistence.JoinColumn; import javax.persistence.OneToOne; - -import org.hibernate.Session; -import org.hibernate.Query; +import javax.persistence.SequenceGenerator; +import javax.persistence.Table; import org.apache.log4j.Logger; -import de.intevation.flys.backend.SessionHolder; +import org.hibernate.Query; +import org.hibernate.Session; @Entity @@ -31,12 +32,8 @@ private Integer id; - private River river; - private DischargeZone dischargeZone; - private List<FlowVelocityModelValue> values; - private String description; @@ -44,17 +41,15 @@ } - public FlowVelocityModel(River river, DischargeZone dischargeZone) { - this(river, dischargeZone, null); + public FlowVelocityModel(DischargeZone dischargeZone) { + this(dischargeZone, null); } public FlowVelocityModel( - River river, DischargeZone dischargeZone, String description ) { - this.river = river; this.dischargeZone = dischargeZone; this.description = description; } @@ -77,16 +72,6 @@ } @OneToOne - @JoinColumn(name = "river_id") - public River getRiver() { - return river; - } - - public void setRiver(River river) { - this.river = river; - } - - @OneToOne @JoinColumn(name = "discharge_zone_id") public DischargeZone getDischargeZone() { return dischargeZone; @@ -106,16 +91,13 @@ } - public static List<FlowVelocityModel> getModels( - River river, - DischargeZone zone - ) { + public static List<FlowVelocityModel> getModels(DischargeZone zone) { + Session session = SessionHolder.HOLDER.get(); Query query = session.createQuery( - "from FlowVelocityModel where river=:river and dischargeZone=:zone"); + "from FlowVelocityModel where dischargeZone=:zone"); - query.setParameter("river", river); query.setParameter("zone", zone); return query.list();