comparison flys-backend/src/main/java/de/intevation/flys/model/WstColumn.java @ 174:249390dd24e7

Added foreign key constraint annotations to model classes. flys-backend/trunk@1473 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Tue, 15 Mar 2011 14:49:56 +0000
parents 605320b7df94
children 3169b559ca3c
comparison
equal deleted inserted replaced
173:8e2f2ddc507f 174:249390dd24e7
1 package de.intevation.flys.model; 1 package de.intevation.flys.model;
2
3 import java.util.List;
2 4
3 import java.io.Serializable; 5 import java.io.Serializable;
4 6
5 import javax.persistence.Entity; 7 import javax.persistence.Entity;
6 import javax.persistence.Id; 8 import javax.persistence.Id;
7 import javax.persistence.Table; 9 import javax.persistence.Table;
8 import javax.persistence.GeneratedValue; 10 import javax.persistence.GeneratedValue;
9 import javax.persistence.Column; 11 import javax.persistence.Column;
10 import javax.persistence.SequenceGenerator; 12 import javax.persistence.SequenceGenerator;
11 import javax.persistence.GenerationType; 13 import javax.persistence.GenerationType;
14 import javax.persistence.JoinColumn;
15 import javax.persistence.OneToOne;
16 import javax.persistence.OneToMany;
12 17
13 @Entity 18 @Entity
14 @Table(name = "wst_columns") 19 @Table(name = "wst_columns")
15 public class WstColumn 20 public class WstColumn
16 implements Serializable 21 implements Serializable
17 { 22 {
18 private Integer id; 23 private Integer id;
19 private Wst wst; 24 private Wst wst;
20 private String name; 25 private String name;
21 private String description; 26 private String description;
22 private TimeInterval timeInterval; 27 private TimeInterval timeInterval;
28 private List<WstColumnQRange> columnQRanges;
29 private List<WstColumnValue> columnValues;
23 30
24 public WstColumn() { 31 public WstColumn() {
25 } 32 }
26 33
27 @Id 34 @Id
39 46
40 public void setId(Integer id) { 47 public void setId(Integer id) {
41 this.id = id; 48 this.id = id;
42 } 49 }
43 50
51 @OneToOne
52 @JoinColumn(name = "wst_id" )
44 public Wst getWst() { 53 public Wst getWst() {
45 return wst; 54 return wst;
46 } 55 }
47 56
48 public void setWst(Wst wst) { 57 public void setWst(Wst wst) {
65 74
66 public void setDescription(String description) { 75 public void setDescription(String description) {
67 this.description = description; 76 this.description = description;
68 } 77 }
69 78
79 @OneToOne
80 @JoinColumn(name = "time_interval_id" )
81 public TimeInterval getTimeInterval() {
82 return timeInterval;
83 }
84
70 public void setTimeInterval(TimeInterval timeInterval) { 85 public void setTimeInterval(TimeInterval timeInterval) {
71 this.timeInterval = timeInterval; 86 this.timeInterval = timeInterval;
72 } 87 }
73 88
74 public TimeInterval getTimeInterval() { 89 @OneToMany
75 return timeInterval; 90 @JoinColumn(name="wst_column_id")
91 public List<WstColumnQRange> getColumnQRanges() {
92 return columnQRanges;
93 }
94
95 public void setColumnQRanges(List<WstColumnQRange> columnQRanges) {
96 this.columnQRanges = columnQRanges;
97 }
98
99 @OneToMany
100 @JoinColumn(name="wst_column_id")
101 public List<WstColumnValue> getColumnValues() {
102 return columnValues;
103 }
104
105 public void setColumnValues(List<WstColumnValue> columnValues) {
106 this.columnValues = columnValues;
76 } 107 }
77 } 108 }
78 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : 109 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :

http://dive4elements.wald.intevation.org