Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/Hws.java @ 3820:8a75cf0841b1 pre2.7-2012-03-16
merged flys-backend/pre2.7-2012-03-16
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:59 +0200 |
parents | a8f408fdf58c |
children | 77e849c0d248 |
comparison
equal
deleted
inserted
replaced
3818:dc18457b1cef | 3820:8a75cf0841b1 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 import java.util.List; | |
5 | |
6 import javax.persistence.Column; | |
7 import javax.persistence.Entity; | |
8 import javax.persistence.Id; | |
9 import javax.persistence.JoinColumn; | |
10 import javax.persistence.OneToOne; | |
11 import javax.persistence.Table; | |
12 | |
13 import org.hibernate.Session; | |
14 import org.hibernate.Query; | |
15 import org.hibernate.annotations.Type; | |
16 | |
17 import com.vividsolutions.jts.geom.LineString; | |
18 | |
19 import de.intevation.flys.backend.SessionHolder; | |
20 | |
21 | |
22 @Entity | |
23 @Table(name = "hws") | |
24 public class Hws | |
25 implements Serializable | |
26 { | |
27 private Integer id; | |
28 private String facility; | |
29 private String type; | |
30 private River river; | |
31 private LineString geom; | |
32 | |
33 public Hws() { | |
34 } | |
35 | |
36 | |
37 @Id | |
38 @Column(name = "id") | |
39 public Integer getId() { | |
40 return id; | |
41 } | |
42 | |
43 | |
44 public void setId(Integer id) { | |
45 this.id = id; | |
46 } | |
47 | |
48 | |
49 @OneToOne | |
50 @JoinColumn(name = "river_id") | |
51 public River getRiver() { | |
52 return river; | |
53 } | |
54 | |
55 | |
56 public void setRiver(River river) { | |
57 this.river = river; | |
58 } | |
59 | |
60 | |
61 @Column(name = "hws_facility") | |
62 public String getFacility() { | |
63 return facility; | |
64 } | |
65 | |
66 | |
67 public void setFacility(String facility) { | |
68 this.facility = facility; | |
69 } | |
70 | |
71 | |
72 @Column(name = "type") | |
73 public String getType() { | |
74 return type; | |
75 } | |
76 | |
77 | |
78 public void setType(String type) { | |
79 this.type = type; | |
80 } | |
81 | |
82 | |
83 @Column(name = "geom") | |
84 @Type(type = "org.hibernatespatial.GeometryUserType") | |
85 public LineString getGeom() { | |
86 return geom; | |
87 } | |
88 | |
89 | |
90 public void setGeom(LineString geom) { | |
91 this.geom = geom; | |
92 } | |
93 | |
94 | |
95 public static List<Hws> getHws(int riverId) { | |
96 Session session = SessionHolder.HOLDER.get(); | |
97 | |
98 Query query = session.createQuery( | |
99 "from Hws where river.id =:river_id"); | |
100 query.setParameter("river_id", riverId); | |
101 | |
102 return query.list(); | |
103 } | |
104 } | |
105 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |