Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/Fixpoint.java @ 3815:ecab7e7804a9 pre2.6-2012-01-04
merged flys-backend/pre2.6-2012-01-04
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:57 +0200 |
parents | 2246348ff90e |
children |
comparison
equal
deleted
inserted
replaced
3814:8083f6384023 | 3815:ecab7e7804a9 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 import java.math.BigDecimal; | |
5 import java.util.List; | |
6 | |
7 import javax.persistence.Column; | |
8 import javax.persistence.Entity; | |
9 import javax.persistence.Id; | |
10 import javax.persistence.JoinColumn; | |
11 import javax.persistence.OneToOne; | |
12 import javax.persistence.Table; | |
13 | |
14 import org.hibernate.Session; | |
15 import org.hibernate.Query; | |
16 import org.hibernate.annotations.Type; | |
17 | |
18 import com.vividsolutions.jts.geom.Point; | |
19 | |
20 import de.intevation.flys.backend.SessionHolder; | |
21 | |
22 | |
23 @Entity | |
24 @Table(name = "fixpoints") | |
25 public class Fixpoint | |
26 implements Serializable | |
27 { | |
28 private Integer id; | |
29 private River river; | |
30 private Integer x; | |
31 private Integer y; | |
32 private BigDecimal km; | |
33 private String hpgp; | |
34 private Point geom; | |
35 | |
36 public Fixpoint() { | |
37 } | |
38 | |
39 | |
40 @Id | |
41 @Column(name = "id") | |
42 public Integer getId() { | |
43 return id; | |
44 } | |
45 | |
46 | |
47 public void setId(Integer id) { | |
48 this.id = id; | |
49 } | |
50 | |
51 | |
52 @OneToOne | |
53 @JoinColumn(name = "river_id") | |
54 public River getRiver() { | |
55 return river; | |
56 } | |
57 | |
58 | |
59 public void setRiver(River river) { | |
60 this.river = river; | |
61 } | |
62 | |
63 | |
64 @Column(name = "x") | |
65 public Integer getX() { | |
66 return x; | |
67 } | |
68 | |
69 | |
70 public void setX(Integer x) { | |
71 this.x = x; | |
72 } | |
73 | |
74 | |
75 @Column(name = "y") | |
76 public Integer getY() { | |
77 return y; | |
78 } | |
79 | |
80 | |
81 public void setY(Integer y) { | |
82 this.y = y; | |
83 } | |
84 | |
85 | |
86 @Column(name = "km") | |
87 public BigDecimal getKm() { | |
88 return km; | |
89 } | |
90 | |
91 | |
92 public void setKm(BigDecimal km) { | |
93 this.km = km; | |
94 } | |
95 | |
96 | |
97 @Column(name = "hpgp") | |
98 public String getHpgp() { | |
99 return hpgp; | |
100 } | |
101 | |
102 | |
103 public void setHpgp(String hpgp) { | |
104 this.hpgp = hpgp; | |
105 } | |
106 | |
107 | |
108 @Column(name = "geom") | |
109 @Type(type = "org.hibernatespatial.GeometryUserType") | |
110 public Point getGeom() { | |
111 return geom; | |
112 } | |
113 | |
114 | |
115 public void setGeom(Point geom) { | |
116 this.geom = geom; | |
117 } | |
118 | |
119 | |
120 public static List<Fixpoint> getFixpoints(int riverId) { | |
121 Session session = SessionHolder.HOLDER.get(); | |
122 | |
123 Query query = session.createQuery( | |
124 "from Fixpoint where river.id =:river_id"); | |
125 query.setParameter("river_id", riverId); | |
126 | |
127 return query.list(); | |
128 } | |
129 } | |
130 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |