Mercurial > dive4elements > river
changeset 171:4a83e14f40f9
Added entity and id annotations.
flys-backend/trunk@1463 c6561f87-3c4e-4783-a992-168aeb5c3f6f
line wrap: on
line diff
--- a/flys-backend/ChangeLog Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/ChangeLog Mon Mar 14 14:52:58 2011 +0000 @@ -1,3 +1,11 @@ +2011-03-14 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * doc/schema/postgresql.sql, doc/schema/postgresql-cleanup.sql: + Fixed inconsistent table names. + + * src/main/java/de/intevation/flys/model/*.java: Added + entity and id annotations. + 2011-03-14 Sascha L. Teichmann <sascha.teichmann@intevation.de> * doc/schema/postgresql.sql, doc/schema/postgresql-cleanup.sql:
--- a/flys-backend/doc/schema/postgresql-cleanup.sql Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/doc/schema/postgresql-cleanup.sql Mon Mar 14 14:52:58 2011 +0000 @@ -26,8 +26,8 @@ DROP SEQUENCE WST_COLUMN_Q_RANGES_ID_SEQ; DROP SEQUENCE WST_Q_RANGES_ID_SEQ; DROP SEQUENCE WST_COLUMN_VALUES_ID_SEQ; -DROP SEQUENCE WST_COLUMN_ID_SEQ; -DROP SEQUENCE WST_ID_SEQ; +DROP SEQUENCE WST_COLUMNS_ID_SEQ; +DROP SEQUENCE WSTS_ID_SEQ; DROP SEQUENCE DISCHARGE_TABLE_VALUES_ID_SEQ; DROP SEQUENCE DISCHARGE_TABLES_ID_SEQ; DROP SEQUENCE MAIN_VALUES_ID_SEQ;
--- a/flys-backend/doc/schema/postgresql.sql Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/doc/schema/postgresql.sql Mon Mar 14 14:52:58 2011 +0000 @@ -134,9 +134,9 @@ ); -- WST files -CREATE SEQUENCE WST_ID_SEQ; +CREATE SEQUENCE WSTS_ID_SEQ; -CREATE TABLE wst ( +CREATE TABLE wsts ( id int PRIMARY KEY NOT NULL, river_id int NOT NULL REFERENCES rivers(id), description VARCHAR(256) NOT NULL, @@ -145,9 +145,9 @@ ); -- columns of WST files -CREATE SEQUENCE WST_COLUMN_ID_SEQ; +CREATE SEQUENCE WST_COLUMNS_ID_SEQ; -CREATE TABLE wst_column ( +CREATE TABLE wst_columns ( id int PRIMARY KEY NOT NULL, wst_id int NOT NULL REFERENCES wst(id), name VARCHAR(256) NOT NULL, @@ -163,7 +163,7 @@ CREATE TABLE wst_column_values ( id int PRIMARY KEY NOT NULL, - wst_column_id int NOT NULL REFERENCES wst_column(id), + wst_column_id int NOT NULL REFERENCES wst_columns(id), position NUMERIC NOT NULL, w NUMERIC NOT NULL,
--- a/flys-backend/src/main/java/de/intevation/flys/model/Annotation.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Annotation.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,6 +2,16 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "annotations") public class Annotation implements Serializable { @@ -13,14 +23,23 @@ public Annotation() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_ANNOTATIONS_ID_SEQ", + sequenceName = "ANNOTATIONS_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_ANNOTATIONS_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setRange(Range range) { this.range = range; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/Attribute.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Attribute.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,6 +2,16 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "attributes") public class Attribute implements Serializable { @@ -12,14 +22,23 @@ public Attribute() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_ATTRIBUTES_ID_SEQ", + sequenceName = "ATTRIBUTES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_ATTRIBUTES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setValue(String value) { this.value = value; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/DischargeTable.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/DischargeTable.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,6 +2,16 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "discharge_tables") public class DischargeTable implements Serializable { @@ -12,14 +22,23 @@ public DischargeTable() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ", + sequenceName = "DISCHARGE_TABLES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_DISCHARGE_TABLES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setTimeInterval(TimeInterval timeInterval) { this.timeInterval = timeInterval; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/DischargeTableValue.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/DischargeTableValue.java Mon Mar 14 14:52:58 2011 +0000 @@ -4,10 +4,20 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "discharge_table_values") public class DischargeTableValue implements Serializable { - private Integer id; + private Integer id; private DischargeTable dischargeTable; private BigDecimal q; private BigDecimal w; @@ -15,14 +25,24 @@ public DischargeTableValue() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_DISCHARGE_TABLE_VALUES_ID_SEQ", + sequenceName = "DISCHARGE_TABLE_VALUES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_DISCHARGE_TABLE_VALUES_ID_SEQ") + @Column(name = "id") + + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setDischargeTable(DischargeTable dischargeTable) { this.dischargeTable = dischargeTable; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Gauge.java Mon Mar 14 14:52:58 2011 +0000 @@ -4,10 +4,20 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "gauges") public class Gauge implements Serializable { - private Integer id; + private Integer id; private String name; private River river; private BigDecimal station; @@ -18,14 +28,23 @@ public Gauge() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_GAUGES_ID_SEQ", + sequenceName = "GAUGES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_GAUGES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setName(String name) { this.name = name; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/MainValueType.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/MainValueType.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,6 +2,16 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "main_value_types") public class MainValueType implements Serializable { @@ -12,14 +22,23 @@ public MainValueType() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_MAIN_VALUE_TYPES_ID_SEQ", + sequenceName = "MAIN_VALUE_TYPES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_MAIN_VALUE_TYPES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setValue(String value) { this.value = value; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/NamedMainValues.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/NamedMainValues.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,24 +2,43 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "named_main_values") public class NamedMainValues implements Serializable { - private Integer id; + private Integer id; private String name; private MainValueType type; public NamedMainValues() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_NAMED_MAIN_VALUES_ID_SEQ", + sequenceName = "NAMED_MAIN_VALUES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_NAMED_MAIN_VALUES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setName(String name) { this.name = name; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/Position.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Position.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,24 +2,43 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "positions") public class Position implements Serializable { - private Integer id; + private Integer id; - private String value; + private String value; public Position() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_POSITIONS_ID_SEQ", + sequenceName = "POSITIONS_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_POSITIONS_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setValue(String value) { this.value = value; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/Range.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Range.java Mon Mar 14 14:52:58 2011 +0000 @@ -4,10 +4,20 @@ import java.math.BigDecimal; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "ranges") public class Range implements Serializable { - private Integer id; + private Integer id; private BigDecimal a; private BigDecimal b; @@ -16,14 +26,23 @@ public Range() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_RANGES_ID_SEQ", + sequenceName = "RANGES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_RANGES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setA(BigDecimal a) { this.a = a; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/River.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/River.java Mon Mar 14 14:52:58 2011 +0000 @@ -8,7 +8,6 @@ import javax.persistence.GeneratedValue; import javax.persistence.Column; import javax.persistence.SequenceGenerator; - import javax.persistence.GenerationType; @Entity @@ -22,12 +21,12 @@ @Id @SequenceGenerator( - name = "SEQUENCE RIVERS_ID_SEQ", + name = "SEQUENCE_RIVERS_ID_SEQ", sequenceName = "RIVERS_ID_SEQ", allocationSize = 1) @GeneratedValue( strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE RIVERS_ID_SEQ") + generator = "SEQUENCE_RIVERS_ID_SEQ") @Column(name = "id") public Integer getId() { return id;
--- a/flys-backend/src/main/java/de/intevation/flys/model/TimeInterval.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/TimeInterval.java Mon Mar 14 14:52:58 2011 +0000 @@ -4,6 +4,16 @@ import java.util.Date; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "time_intervals") public class TimeInterval implements Serializable { @@ -14,14 +24,23 @@ public TimeInterval() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_TIME_INTERVALS_ID_SEQ", + sequenceName = "TIME_INTERVALS_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_TIME_INTERVALS_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setStartTime(Date startTime) { this.startTime = startTime; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/Wst.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/Wst.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,24 +2,43 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "wsts") public class Wst implements Serializable { - private Integer id; - private River river; - private String description; + private Integer id; + private River river; + private String description; public Wst() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_WSTS_ID_SEQ", + sequenceName = "WSTS_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_WSTS_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setRiver(River river) { this.river = river; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/WstColumn.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/WstColumn.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,10 +2,20 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "wst_columns") public class WstColumn implements Serializable { - private Integer id; + private Integer id; private Wst wst; private String name; private String description; @@ -14,14 +24,23 @@ public WstColumn() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_WST_COLUMNS_ID_SEQ", + sequenceName = "WST_COLUMNS_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_WST_COLUMNS_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setWst(Wst wst) { this.wst = wst; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/WstColumnQRange.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/WstColumnQRange.java Mon Mar 14 14:52:58 2011 +0000 @@ -2,24 +2,43 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "wst_column_q_ranges") public class WstColumnQRange implements Serializable { - private Integer id; + private Integer id; private WstColumn wstColumn; private WstQRange wstQRange; public WstColumnQRange() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_WST_Q_RANGES_ID_SEQ", + sequenceName = "WST_Q_RANGES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_WST_Q_RANGES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setWstColumn(WstColumn wstColumn) { this.wstColumn = wstColumn; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/WstColumnValue.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/WstColumnValue.java Mon Mar 14 14:52:58 2011 +0000 @@ -4,10 +4,20 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "wst_column_values") public class WstColumnValue implements Serializable { - private Integer id; + private Integer id; private WstColumn wstColumn; private Position position; private BigDecimal w; @@ -15,14 +25,23 @@ public WstColumnValue() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_WST_COLUMN_VALUES_ID_SEQ", + sequenceName = "WST_COLUMN_VALUES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_WST_COLUMN_VALUES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setWstColumn(WstColumn wstColumn) { this.wstColumn = wstColumn; }
--- a/flys-backend/src/main/java/de/intevation/flys/model/WstQRange.java Mon Mar 14 11:31:00 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/WstQRange.java Mon Mar 14 14:52:58 2011 +0000 @@ -4,24 +4,43 @@ import java.io.Serializable; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import javax.persistence.GeneratedValue; +import javax.persistence.Column; +import javax.persistence.SequenceGenerator; +import javax.persistence.GenerationType; + +@Entity +@Table(name = "wst_q_ranges") public class WstQRange implements Serializable { - private Integer id; + private Integer id; private Range range; private BigDecimal q; public WstQRange() { } + @Id + @SequenceGenerator( + name = "SEQUENCE_WST_Q_RANGES_ID_SEQ", + sequenceName = "WST_Q_RANGES_ID_SEQ", + allocationSize = 1) + @GeneratedValue( + strategy = GenerationType.SEQUENCE, + generator = "SEQUENCE_WST_Q_RANGES_ID_SEQ") + @Column(name = "id") + public Integer getId() { + return id; + } + public void setId(Integer id) { this.id = id; } - public Integer getId() { - return id; - } - public void setRange(Range range) { this.range = range; }