Mercurial > dive4elements > river
annotate flys-backend/src/main/java/de/intevation/flys/model/WaterlevelDifferenceValue.java @ 5181:9d36ddf7dbd3
Change IllegalArgumentException to HibernateException.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Thu, 07 Mar 2013 10:44:27 +0100 |
parents | e7a1d78b66d8 |
children |
rev | line source |
---|---|
2847
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
1 package de.intevation.flys.model; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
2 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
3 import java.io.Serializable; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
4 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
5 import javax.persistence.Entity; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
6 import javax.persistence.Id; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
7 import javax.persistence.Table; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
8 import javax.persistence.GeneratedValue; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
9 import javax.persistence.Column; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
10 import javax.persistence.SequenceGenerator; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
11 import javax.persistence.GenerationType; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
12 import javax.persistence.JoinColumn; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
13 import javax.persistence.OneToOne; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
14 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
15 import org.apache.log4j.Logger; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
16 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
17 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
18 @Entity |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
19 @Table(name = "waterlevel_difference_values") |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
20 public class WaterlevelDifferenceValue |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
21 implements Serializable |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
22 { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
23 private static Logger logger = |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
24 Logger.getLogger(WaterlevelDifferenceValue.class); |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
25 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
26 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
27 private Integer id; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
28 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
29 private WaterlevelDifferenceColumn column; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
30 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
31 private Double station; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
32 private Double value; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
33 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
34 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
35 public WaterlevelDifferenceValue() { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
36 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
37 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
38 public WaterlevelDifferenceValue( |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
39 WaterlevelDifferenceColumn column, |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
40 Double station, |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
41 Double value |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
42 ) { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
43 this.column = column; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
44 this.station = station; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
45 this.value = value; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
46 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
47 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
48 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
49 @Id |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
50 @SequenceGenerator( |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
51 name = "SEQUENCE_WATERLEVEL_DIFF_VALUES_ID_SEQ", |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
52 sequenceName = "WATERLEVEL_DIFF_VALUES_ID_SEQ", |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
53 allocationSize = 1) |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
54 @GeneratedValue( |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
55 strategy = GenerationType.SEQUENCE, |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
56 generator = "SEQUENCE_WATERLEVEL_DIFF_VALUES_ID_SEQ") |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
57 @Column(name = "id") |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
58 public Integer getId() { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
59 return id; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
60 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
61 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
62 public void setId(Integer id) { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
63 this.id = id; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
64 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
65 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
66 @OneToOne |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
67 @JoinColumn(name = "column_id" ) |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
68 public WaterlevelDifferenceColumn getColumn() { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
69 return column; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
70 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
71 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
72 public void setColumn(WaterlevelDifferenceColumn column) { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
73 this.column = column; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
74 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
75 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
76 @Column(name = "station") |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
77 public Double getStation() { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
78 return station; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
79 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
80 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
81 public void setStation(Double station) { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
82 this.station = station; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
83 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
84 |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
85 @Column(name = "value") |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
86 public Double getValue() { |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
87 return value; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
88 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
89 |
2848
e7a1d78b66d8
Fix for wrong method name in WaterlevelDifferenceValue hibernated class.
Felix Wolfsteller <felix.wolfsteller@intevation.de>
parents:
2847
diff
changeset
|
90 public void setValue(Double value) { |
2847
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
91 this.value = value; |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
92 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
93 } |
dfc5bc5660c2
Added model classes for MINFO specific waterlevel differences.
Ingo Weinzierl <ingo.weinzierl@intevation.de>
parents:
diff
changeset
|
94 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : |