ingo@1230: package de.intevation.flys.model; ingo@1230: ingo@1230: import java.io.Serializable; ingo@1230: import java.math.BigDecimal; ingo@2366: import java.util.List; ingo@1230: ingo@1230: import javax.persistence.Column; ingo@1230: import javax.persistence.Entity; ingo@1230: import javax.persistence.Id; ingo@1230: import javax.persistence.JoinColumn; ingo@1230: import javax.persistence.OneToOne; ingo@1230: import javax.persistence.Table; ingo@1230: ingo@2366: import org.hibernate.Session; ingo@2366: import org.hibernate.Query; ingo@1230: import org.hibernate.annotations.Type; ingo@1230: ingo@1230: import com.vividsolutions.jts.geom.Point; ingo@1230: ingo@2366: import de.intevation.flys.backend.SessionHolder; ingo@2366: ingo@1230: ingo@1230: @Entity ingo@1230: @Table(name = "fixpoints") ingo@1230: public class Fixpoint ingo@1230: implements Serializable ingo@1230: { ingo@1230: private Integer id; ingo@1230: private River river; ingo@1230: private Integer x; ingo@1230: private Integer y; ingo@1230: private BigDecimal km; ingo@1230: private String hpgp; ingo@1230: private Point geom; ingo@1230: ingo@1230: public Fixpoint() { ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @Id ingo@1230: @Column(name = "id") ingo@1230: public Integer getId() { ingo@1230: return id; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setId(Integer id) { ingo@1230: this.id = id; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @OneToOne ingo@1230: @JoinColumn(name = "river_id") ingo@1230: public River getRiver() { ingo@1230: return river; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setRiver(River river) { ingo@1230: this.river = river; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @Column(name = "x") ingo@1230: public Integer getX() { ingo@1230: return x; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setX(Integer x) { ingo@1230: this.x = x; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @Column(name = "y") ingo@1230: public Integer getY() { ingo@1230: return y; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setY(Integer y) { ingo@1230: this.y = y; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @Column(name = "km") ingo@1230: public BigDecimal getKm() { ingo@1230: return km; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setKm(BigDecimal km) { ingo@1230: this.km = km; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @Column(name = "hpgp") ingo@1230: public String getHpgp() { ingo@1230: return hpgp; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setHpgp(String hpgp) { ingo@1230: this.hpgp = hpgp; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: @Column(name = "geom") ingo@1230: @Type(type = "org.hibernatespatial.GeometryUserType") ingo@1230: public Point getGeom() { ingo@1230: return geom; ingo@1230: } ingo@1230: ingo@1230: ingo@1230: public void setGeom(Point geom) { ingo@1230: this.geom = geom; ingo@1230: } ingo@2366: ingo@2366: ingo@2366: public static List getFixpoints(int riverId) { ingo@2366: Session session = SessionHolder.HOLDER.get(); ingo@2366: ingo@2366: Query query = session.createQuery( ingo@2366: "from Fixpoint where river.id =:river_id"); ingo@2366: query.setParameter("river_id", riverId); ingo@2366: ingo@2366: return query.list(); ingo@2366: } ingo@1230: } ingo@1230: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :