Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/HYK.java @ 2877:f0a67bc0e777 2.7
merged flys-backend/2.7
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:14:31 +0200 |
parents | ca7d461a53f1 |
children |
comparison
equal
deleted
inserted
replaced
2793:6310b1582f2d | 2877:f0a67bc0e777 |
---|---|
1 package de.intevation.flys.model; | |
2 | |
3 import java.io.Serializable; | |
4 | |
5 import java.util.List; | |
6 | |
7 import javax.persistence.Entity; | |
8 import javax.persistence.Id; | |
9 import javax.persistence.Table; | |
10 import javax.persistence.GeneratedValue; | |
11 import javax.persistence.Column; | |
12 import javax.persistence.SequenceGenerator; | |
13 import javax.persistence.GenerationType; | |
14 import javax.persistence.OneToOne; | |
15 import javax.persistence.OneToMany; | |
16 import javax.persistence.OrderBy; | |
17 import javax.persistence.JoinColumn; | |
18 | |
19 @Entity | |
20 @Table(name = "hyks") | |
21 public class HYK | |
22 implements Serializable | |
23 { | |
24 private Integer id; | |
25 private River river; | |
26 private String description; | |
27 | |
28 private List<HYKEntry> entries; | |
29 | |
30 public HYK() { | |
31 } | |
32 | |
33 public HYK(River river, String description) { | |
34 this.river = river; | |
35 this.description = description; | |
36 } | |
37 | |
38 @Id | |
39 @SequenceGenerator( | |
40 name = "SEQUENCE_HYKS_ID_SEQ", | |
41 sequenceName = "HYKS_ID_SEQ", | |
42 allocationSize = 1) | |
43 @GeneratedValue( | |
44 strategy = GenerationType.SEQUENCE, | |
45 generator = "SEQUENCE_HYKS_ID_SEQ") | |
46 @Column(name = "id") | |
47 public Integer getId() { | |
48 return id; | |
49 } | |
50 | |
51 public void setId(Integer id) { | |
52 this.id = id; | |
53 } | |
54 | |
55 @OneToOne | |
56 @JoinColumn(name = "river_id") | |
57 public River getRiver() { | |
58 return river; | |
59 } | |
60 | |
61 public void setRiver(River river) { | |
62 this.river = river; | |
63 } | |
64 | |
65 @Column(name = "description") | |
66 public String getDescription() { | |
67 return description; | |
68 } | |
69 | |
70 public void setDescription(String description) { | |
71 this.description = description; | |
72 } | |
73 | |
74 @OneToMany | |
75 @OrderBy("km") | |
76 @JoinColumn(name="hyk_id") | |
77 public List<HYKEntry> getEntries() { | |
78 return entries; | |
79 } | |
80 | |
81 public void setEntries(List<HYKEntry> entries) { | |
82 this.entries = entries; | |
83 } | |
84 } | |
85 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |