Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/model/SQRelation.java @ 3329:cc8fc6b29649
Store sq relations into database after parsing.
flys-backend/trunk@4647 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Wed, 13 Jun 2012 08:12:00 +0000 |
parents | a2a33eff93aa |
children |
comparison
equal
deleted
inserted
replaced
3328:a41f279a66e2 | 3329:cc8fc6b29649 |
---|---|
9 import javax.persistence.Table; | 9 import javax.persistence.Table; |
10 import javax.persistence.GeneratedValue; | 10 import javax.persistence.GeneratedValue; |
11 import javax.persistence.Column; | 11 import javax.persistence.Column; |
12 import javax.persistence.SequenceGenerator; | 12 import javax.persistence.SequenceGenerator; |
13 import javax.persistence.OneToMany; | 13 import javax.persistence.OneToMany; |
14 import javax.persistence.OneToOne; | |
14 import javax.persistence.JoinColumn; | 15 import javax.persistence.JoinColumn; |
15 import javax.persistence.GenerationType; | 16 import javax.persistence.GenerationType; |
16 | 17 |
17 | 18 |
18 @Entity | 19 @Entity |
19 @Table(name = "sq_relation") | 20 @Table(name = "sq_relation") |
20 public class SQRelation implements Serializable { | 21 public class SQRelation implements Serializable { |
21 | 22 |
22 private Integer id; | 23 private Integer id; |
23 | 24 |
25 private River river; | |
26 | |
24 private TimeInterval timeInterval; | 27 private TimeInterval timeInterval; |
25 | 28 |
26 private String description; | 29 private String description; |
27 | 30 |
28 private List<SQRelationValue> values; | 31 private List<SQRelationValue> values; |
32 | |
33 | |
34 protected SQRelation() { | |
35 } | |
36 | |
37 | |
38 public SQRelation(River river, TimeInterval timeInterval, String desc) { | |
39 this.river = river; | |
40 this.timeInterval = timeInterval; | |
41 this.description = desc; | |
42 } | |
29 | 43 |
30 | 44 |
31 @Id | 45 @Id |
32 @SequenceGenerator( | 46 @SequenceGenerator( |
33 name = "SEQUENCE_SQ_ID_SEQ", | 47 name = "SEQUENCE_SQ_ID_SEQ", |
44 public void setId(Integer id) { | 58 public void setId(Integer id) { |
45 this.id = id; | 59 this.id = id; |
46 } | 60 } |
47 | 61 |
48 | 62 |
63 @OneToOne | |
64 @JoinColumn(name = "river_id") | |
65 public River getRiver() { | |
66 return river; | |
67 } | |
68 | |
69 public void setRiver(River river) { | |
70 this.river = river; | |
71 } | |
72 | |
73 | |
49 @Column(name = "description") | 74 @Column(name = "description") |
50 public String getDescription() { | 75 public String getDescription() { |
51 return description; | 76 return description; |
52 } | 77 } |
53 | 78 |
54 public void setDescription(String description) { | 79 public void setDescription(String description) { |
55 this.description = description; | 80 this.description = description; |
56 } | 81 } |
57 | 82 |
58 | 83 |
59 @Column(name = "time_interval") | 84 @OneToOne |
85 @JoinColumn(name = "time_interval_id") | |
60 public TimeInterval getTimeInterval() { | 86 public TimeInterval getTimeInterval() { |
61 return timeInterval; | 87 return timeInterval; |
62 } | 88 } |
63 | 89 |
64 public void setTimeInterval(TimeInterval timeInterval) { | 90 public void setTimeInterval(TimeInterval timeInterval) { |