Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/Jetty.java @ 5437:b582df0c7b00
Add Jetties to floodmap
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Tue, 26 Mar 2013 17:31:55 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
5436:7dcf604a4bf7 | 5437:b582df0c7b00 |
---|---|
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 com.vividsolutions.jts.geom.Geometry; | |
14 | |
15 import org.hibernate.Session; | |
16 import org.hibernate.Query; | |
17 import org.hibernate.annotations.Type; | |
18 | |
19 import de.intevation.flys.backend.SessionHolder; | |
20 | |
21 @Entity | |
22 @Table(name = "jetties") | |
23 public class Jetty | |
24 implements Serializable | |
25 { | |
26 private Integer id; | |
27 private River river; | |
28 private Geometry geom; | |
29 | |
30 public Jetty() { | |
31 } | |
32 | |
33 | |
34 @Id | |
35 @Column(name = "id") | |
36 public Integer getId() { | |
37 return id; | |
38 } | |
39 | |
40 | |
41 public void setId(Integer id) { | |
42 this.id = id; | |
43 } | |
44 | |
45 | |
46 @OneToOne | |
47 @JoinColumn(name = "river_id") | |
48 public River getRiver() { | |
49 return river; | |
50 } | |
51 | |
52 | |
53 public void setRiver(River river) { | |
54 this.river = river; | |
55 } | |
56 | |
57 @Column(name = "geom") | |
58 @Type(type = "org.hibernatespatial.GeometryUserType") | |
59 public Geometry getGeom() { | |
60 return geom; | |
61 } | |
62 | |
63 | |
64 public void setGeom(Geometry geom) { | |
65 this.geom = geom; | |
66 } | |
67 | |
68 public static List<Jetty> getJetties(int riverId, int kindId) { | |
69 Session session = SessionHolder.HOLDER.get(); | |
70 | |
71 Query query = session.createQuery( | |
72 "from Jetty where river.id =:river_id and kind_id=:kind_id"); | |
73 query.setParameter("kind_id", kindId); | |
74 query.setParameter("river_id", riverId); | |
75 | |
76 return query.list(); | |
77 } | |
78 } | |
79 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |