# HG changeset patch # User Sascha L. Teichmann # Date 1309966538 0 # Node ID 2b4de678e29a539dadd287238b1591c4fcc397b2 # Parent 491892931761dda32b5b2b2cf96fdb57f8b01c06 Removed braindead points3d table flys-backend/trunk@2295 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 491892931761 -r 2b4de678e29a flys-backend/ChangeLog --- a/flys-backend/ChangeLog Wed Jul 06 12:56:59 2011 +0000 +++ b/flys-backend/ChangeLog Wed Jul 06 15:35:38 2011 +0000 @@ -1,3 +1,26 @@ +2011-07-06 Sascha L. Teichmann + + * src/main/java/de/intevation/flys/model/Point3d.java: Deleted. + Not needed (braindead). + + * src/main/java/de/intevation/flys/model/CrossSectionPoint.java: + Directly store the x/y values now. + + * src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java: + Removed registration of Point3d. + + To update existing databases: + + BEGIN; + ALTER TABLE cross_section_points DROP COLUMN point3d_id; + DROP SEQUENCE POINTS3D_ID_SEQ; + DROP TABLE points3d; + ALTER TABLE cross_section_points ADD COLUMN x NUMERIC NOT NULL; + ALTER TABLE cross_section_points ADD COLUMN y NUMERIC NOT NULL; + ALTER TABLE cross_section_points ADD CONSTRAINT + cross_section_points_cross_section_id_key2 UNIQUE (cross_section_id, x); + COMMIT; + 2011-07-06 Sascha L. Teichmann * src/main/java/de/intevation/flys/model/CrossSection.java, diff -r 491892931761 -r 2b4de678e29a flys-backend/doc/schema/postgresql.sql --- a/flys-backend/doc/schema/postgresql.sql Wed Jul 06 12:56:59 2011 +0000 +++ b/flys-backend/doc/schema/postgresql.sql Wed Jul 06 15:35:38 2011 +0000 @@ -272,25 +272,15 @@ UNIQUE (km, river_id) -- XXX: Maybe too hard? ); --- TODO: Use a geometry column in cross_section_points - -CREATE SEQUENCE POINTS3D_ID_SEQ; - -CREATE TABLE points3d ( - id int PRIMARY KEY NOT NULL, - x NUMERIC NOT NULL, - y NUMERIC NOT NULL, - z NUMERIC NOT NULL -); - CREATE SEQUENCE CROSS_SECTION_POINTS_ID_SEQ; CREATE TABLE cross_section_points ( id int PRIMARY KEY NOT NULL, cross_section_id int NOT NULL REFERENCES cross_sections(id), - point3d_id int NOT NULL REFERENCES points3d(id), col_pos int NOT NULL, - UNIQUE (cross_section_id, point3d_id, col_pos), + x NUMERIC NOT NULL, + y NUMERIC NOT NULL + UNIQUE (cross_section_id, x), UNIQUE (cross_section_id, col_pos) ); diff -r 491892931761 -r 2b4de678e29a flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java --- a/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java Wed Jul 06 12:56:59 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/backend/SessionFactoryProvider.java Wed Jul 06 15:35:38 2011 +0000 @@ -21,7 +21,6 @@ import de.intevation.flys.model.MainValueType; import de.intevation.flys.model.NamedMainValue; import de.intevation.flys.model.MainValue; -import de.intevation.flys.model.Point3d; import de.intevation.flys.model.Position; import de.intevation.flys.model.Range; import de.intevation.flys.model.River; @@ -129,7 +128,6 @@ cfg.addAnnotatedClass(MainValueType.class); cfg.addAnnotatedClass(NamedMainValue.class); cfg.addAnnotatedClass(MainValue.class); - cfg.addAnnotatedClass(Point3d.class); cfg.addAnnotatedClass(Position.class); cfg.addAnnotatedClass(Range.class); cfg.addAnnotatedClass(River.class); diff -r 491892931761 -r 2b4de678e29a flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java --- a/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java Wed Jul 06 12:56:59 2011 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/model/CrossSectionPoint.java Wed Jul 06 15:35:38 2011 +0000 @@ -1,5 +1,7 @@ package de.intevation.flys.model; +import java.math.BigDecimal; + import java.io.Serializable; import javax.persistence.Entity; @@ -19,8 +21,9 @@ { private Integer id; private CrossSection crossSection; - private Point3d point; private Integer colPos; + private BigDecimal x; + private BigDecimal y; public CrossSectionPoint() { } @@ -52,16 +55,6 @@ this.crossSection = crossSection; } - @OneToOne - @JoinColumn(name = "point3d_id") - public Point3d getPoint() { - return point; - } - - public void setPoint(Point3d point) { - this.point = point; - } - @Column(name = "col_pos") public Integer getColPos() { return colPos; @@ -70,5 +63,23 @@ public void setColPos(Integer colPos) { this.colPos = colPos; } + + @Column(name = "x") + public BigDecimal getX() { + return x; + } + + public void setX(BigDecimal x) { + this.x = x; + } + + @Column(name = "y") + public BigDecimal getY() { + return y; + } + + public void setY(BigDecimal y) { + this.y = y; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 : diff -r 491892931761 -r 2b4de678e29a flys-backend/src/main/java/de/intevation/flys/model/Point3d.java --- a/flys-backend/src/main/java/de/intevation/flys/model/Point3d.java Wed Jul 06 12:56:59 2011 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -package de.intevation.flys.model; - -import java.io.Serializable; - -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 = "points3d") -public class Point3d -implements Serializable -{ - private Integer id; - private BigDecimal x; - private BigDecimal y; - private BigDecimal z; - - public Point3d() { - } - - public Point3d(BigDecimal x, BigDecimal y, BigDecimal z) { - this.x = x; - this.y = y; - this.z = z; - } - - @Id - @SequenceGenerator( - name = "SEQUENCE_POINTS3D_ID_SEQ", - sequenceName = "POINTS3D_ID_SEQ", - allocationSize = 1) - @GeneratedValue( - strategy = GenerationType.SEQUENCE, - generator = "SEQUENCE_POINTS3D_ID_SEQ") - @Column(name = "id") - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - @Column(name = "x") - public BigDecimal getX() { - return x; - } - - public void setX(BigDecimal x) { - this.x = x; - } - - @Column(name = "y") - public BigDecimal getY() { - return y; - } - - public void setY(BigDecimal y) { - this.y = y; - } - - @Column(name = "z") - public BigDecimal getZ() { - return z; - } - - public void setZ(BigDecimal z) { - this.z = z; - } -} -// vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :