mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
Update for postgis.jdbc version 2021.1.0
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<artifactId>ebean-postgis-types</artifactId>
|
||||
|
||||
<properties>
|
||||
<postgis.jdbc.version>2.5.1</postgis.jdbc.version>
|
||||
<postgis.jdbc.version>2021.1.0</postgis.jdbc.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
@@ -2,9 +2,9 @@ package io.ebean.postgis;
|
||||
|
||||
import io.ebean.core.type.DataBinder;
|
||||
import io.ebeaninternal.server.type.GeoTypeBinder;
|
||||
import net.postgis.jdbc.PGgeometryLW;
|
||||
import net.postgis.jdbc.geometry.Geometry;
|
||||
import org.geolatte.geom.codec.Wkt;
|
||||
import org.postgis.Geometry;
|
||||
import org.postgis.PGgeometryLW;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
@@ -18,15 +18,15 @@ class PostgisGeoTypeBinder implements GeoTypeBinder {
|
||||
|
||||
@Override
|
||||
public void bind(DataBinder binder, int dataType, Object data) throws SQLException {
|
||||
if (data instanceof Geometry) {
|
||||
binder.setObject(new PGgeometryLW((Geometry) data));
|
||||
} else if (withGeolatte) {
|
||||
binder.setObject(new PGgeometryLW(toWktString(data)));
|
||||
}
|
||||
if (data instanceof Geometry) {
|
||||
binder.setObject(new PGgeometryLW((Geometry) data));
|
||||
} else if (withGeolatte) {
|
||||
binder.setObject(new PGgeometryLW(toWktString(data)));
|
||||
}
|
||||
}
|
||||
|
||||
private String toWktString(Object data) {
|
||||
org.geolatte.geom.Geometry<?> geoLatte = (org.geolatte.geom.Geometry<?>)data;
|
||||
org.geolatte.geom.Geometry<?> geoLatte = (org.geolatte.geom.Geometry<?>) data;
|
||||
return Wkt.newEncoder(Wkt.Dialect.POSTGIS_EWKT_1).encode(geoLatte);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,11 +6,11 @@ import io.ebean.core.type.DataBinder;
|
||||
import io.ebean.core.type.DataReader;
|
||||
import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import org.postgis.Geometry;
|
||||
import org.postgis.GeometryBuilder;
|
||||
import org.postgis.PGgeometry;
|
||||
import org.postgis.PGgeometryLW;
|
||||
import org.postgis.binary.BinaryParser;
|
||||
import net.postgis.jdbc.geometry.Geometry;
|
||||
import net.postgis.jdbc.geometry.GeometryBuilder;
|
||||
import net.postgis.jdbc.geometry.binary.BinaryParser;
|
||||
import net.postgis.jdbc.PGgeometry;
|
||||
import net.postgis.jdbc.PGgeometryLW;
|
||||
import org.postgresql.util.PGobject;
|
||||
|
||||
import java.io.DataInput;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.postgis;
|
||||
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import org.postgis.LineString;
|
||||
import net.postgis.jdbc.geometry.LineString;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package io.ebean.postgis;
|
||||
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import org.postgis.MultiLineString;
|
||||
import net.postgis.jdbc.geometry.MultiLineString;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.postgis;
|
||||
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import org.postgis.MultiPoint;
|
||||
import net.postgis.jdbc.geometry.MultiPoint;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.postgis;
|
||||
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import org.postgis.MultiPolygon;
|
||||
import net.postgis.jdbc.geometry.MultiPolygon;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.postgis;
|
||||
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import org.postgis.Point;
|
||||
import net.postgis.jdbc.geometry.Point;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package io.ebean.postgis;
|
||||
|
||||
import io.ebean.config.dbplatform.ExtraDbTypes;
|
||||
import org.postgis.Polygon;
|
||||
import net.postgis.jdbc.geometry.Polygon;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
+3
-3
@@ -8,8 +8,8 @@ import io.ebean.core.type.DocPropertyType;
|
||||
import io.ebean.core.type.ScalarType;
|
||||
import org.geolatte.geom.Geometry;
|
||||
import org.geolatte.geom.codec.Wkt;
|
||||
import org.postgis.PGgeometry;
|
||||
import org.postgis.PGgeometryLW;
|
||||
import net.postgis.jdbc.PGgeometry;
|
||||
import net.postgis.jdbc.PGgeometryLW;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
@@ -61,7 +61,7 @@ abstract class ScalarTypeGeoLatteBase<T extends Geometry> implements ScalarType<
|
||||
return null;
|
||||
}
|
||||
if (object instanceof PGgeometry) {
|
||||
org.postgis.Geometry geometry = ((PGgeometry) object).getGeometry();
|
||||
net.postgis.jdbc.geometry.Geometry geometry = ((PGgeometry) object).getGeometry();
|
||||
return (T) Wkt.newDecoder(Wkt.Dialect.POSTGIS_EWKT_1).decode(geometry.toString());
|
||||
}
|
||||
throw new IllegalStateException("Received object of type " + object.getClass().getCanonicalName());
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package org.example.domain;
|
||||
|
||||
import io.ebean.annotation.Cache;
|
||||
import org.postgis.Point;
|
||||
import org.postgis.Polygon;
|
||||
import net.postgis.jdbc.geometry.Point;
|
||||
import net.postgis.jdbc.geometry.Polygon;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.Table;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
package org.example.domain;
|
||||
|
||||
import org.postgis.LineString;
|
||||
import org.postgis.MultiLineString;
|
||||
import org.postgis.MultiPoint;
|
||||
import org.postgis.MultiPolygon;
|
||||
import org.postgis.Point;
|
||||
import org.postgis.Polygon;
|
||||
import net.postgis.jdbc.geometry.LineString;
|
||||
import net.postgis.jdbc.geometry.MultiLineString;
|
||||
import net.postgis.jdbc.geometry.MultiPoint;
|
||||
import net.postgis.jdbc.geometry.MultiPolygon;
|
||||
import net.postgis.jdbc.geometry.Point;
|
||||
import net.postgis.jdbc.geometry.Polygon;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
@@ -2,8 +2,8 @@ package org.example.domain;
|
||||
|
||||
import io.ebean.DB;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.postgis.Point;
|
||||
import org.postgis.Polygon;
|
||||
import net.postgis.jdbc.geometry.Point;
|
||||
import net.postgis.jdbc.geometry.Polygon;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
|
||||
@@ -2,12 +2,12 @@ package org.example.domain;
|
||||
|
||||
import io.ebean.DB;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.postgis.LineString;
|
||||
import org.postgis.MultiLineString;
|
||||
import org.postgis.MultiPoint;
|
||||
import org.postgis.MultiPolygon;
|
||||
import org.postgis.Point;
|
||||
import org.postgis.Polygon;
|
||||
import net.postgis.jdbc.geometry.LineString;
|
||||
import net.postgis.jdbc.geometry.MultiLineString;
|
||||
import net.postgis.jdbc.geometry.MultiPoint;
|
||||
import net.postgis.jdbc.geometry.MultiPolygon;
|
||||
import net.postgis.jdbc.geometry.Point;
|
||||
import net.postgis.jdbc.geometry.Polygon;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -181,7 +181,7 @@ public class TestQuery {
|
||||
.find(MyBean.class)
|
||||
.where()
|
||||
.raw("st_distance(wgs84Point, ?) < 0.011", toWkt(geolatteClosePoint))
|
||||
.raw("st_distance(wgs84Point, ?) < 0.011", new org.postgis.Point(toWkt(geolatteClosePoint)))
|
||||
.raw("st_distance(wgs84Point, ?) < 0.011", new net.postgis.jdbc.geometry.Point(toWkt(geolatteClosePoint)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -190,7 +190,7 @@ public class TestQuery {
|
||||
.find(MyBean.class)
|
||||
.where()
|
||||
.raw("st_distance(wgs84Point, ?) < 0.009", toWkt(geolatteClosePoint))
|
||||
.raw("st_distance(wgs84Point, ?) < 0.009", new org.postgis.Point(toWkt(geolatteClosePoint)))
|
||||
.raw("st_distance(wgs84Point, ?) < 0.009", new net.postgis.jdbc.geometry.Point(toWkt(geolatteClosePoint)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -199,7 +199,7 @@ public class TestQuery {
|
||||
.find(MyBean.class)
|
||||
.where()
|
||||
.raw("ST_Within(wgs84Point, ST_GeomFromText(?))", toWkt(enclosingPolygon))
|
||||
.raw("ST_Within(wgs84Point, ?)", new org.postgis.Polygon(toWkt(enclosingPolygon)))
|
||||
.raw("ST_Within(wgs84Point, ?)", new net.postgis.jdbc.geometry.Polygon(toWkt(enclosingPolygon)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -207,7 +207,7 @@ public class TestQuery {
|
||||
DB.find(MyBean.class)
|
||||
.where()
|
||||
.raw("wgs84Point = ST_PointN(ST_GeomFromText(?), 2)", toWkt(lineString))
|
||||
.raw("wgs84Point = ST_PointN(?, 2)", new org.postgis.LineString(toWkt(lineString)))
|
||||
.raw("wgs84Point = ST_PointN(?, 2)", new net.postgis.jdbc.geometry.LineString(toWkt(lineString)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -215,7 +215,7 @@ public class TestQuery {
|
||||
DB.find(OtherBeanGeoLatte.class)
|
||||
.where()
|
||||
.raw("wgs84Point = ST_PointN(ST_LineFromMultiPoint(ST_GeomFromText(?)), 2)", toWkt(multiPoint))
|
||||
.raw("wgs84Point = ST_PointN(ST_LineFromMultiPoint(?), 2)", new org.postgis.MultiPoint(toWkt(multiPoint)))
|
||||
.raw("wgs84Point = ST_PointN(ST_LineFromMultiPoint(?), 2)", new net.postgis.jdbc.geometry.MultiPoint(toWkt(multiPoint)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -223,7 +223,7 @@ public class TestQuery {
|
||||
DB.find(OtherBeanGeoLatte.class)
|
||||
.where()
|
||||
.raw("wgs84Point = ST_PointN(ST_LineFromMultiPoint(ST_GeomFromText(?)), 2)", toWkt(multiPoint))
|
||||
.raw("wgs84Point = ST_PointN(ST_LineFromMultiPoint(?), 2)", new org.postgis.MultiPoint(toWkt(multiPoint)))
|
||||
.raw("wgs84Point = ST_PointN(ST_LineFromMultiPoint(?), 2)", new net.postgis.jdbc.geometry.MultiPoint(toWkt(multiPoint)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -232,7 +232,7 @@ public class TestQuery {
|
||||
.find(MyBean.class)
|
||||
.where()
|
||||
.raw("ST_Within(wgs84Point, ST_GeomFromText(?))", toWkt(multiPolygon))
|
||||
.raw("ST_Within(wgs84Point, ?)", new org.postgis.MultiPolygon(toWkt(multiPolygon)))
|
||||
.raw("ST_Within(wgs84Point, ?)", new net.postgis.jdbc.geometry.MultiPolygon(toWkt(multiPolygon)))
|
||||
.findOne()
|
||||
);
|
||||
|
||||
@@ -240,7 +240,7 @@ public class TestQuery {
|
||||
DB.find(OtherBeanGeoLatte.class)
|
||||
.where()
|
||||
.raw("ST_Intersects(wgs84Point, ST_GeomFromText(?))", toWkt(multiLineString))
|
||||
.raw("ST_Intersects(wgs84Point, ?)", new org.postgis.MultiLineString(toWkt(multiLineString)))
|
||||
.raw("ST_Intersects(wgs84Point, ?)", new net.postgis.jdbc.geometry.MultiLineString(toWkt(multiLineString)))
|
||||
.findOne()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,4 +15,4 @@ ebean:
|
||||
image: ghcr.io/baosystems/postgis:15
|
||||
# extensions: postgis
|
||||
# url: jdbc:postgresql_lwgis://localhost:6432/mygisapp
|
||||
# driver: org.postgis.DriverWrapperLW
|
||||
driver: net.postgis.jdbc.DriverWrapperLW
|
||||
|
||||
Reference in New Issue
Block a user