【发布时间】:2015-11-10 06:13:54
【问题描述】:
我正在尝试使用 Spring JDBC 将数据插入到 postgres (postgis) 数据库,但出现以下错误:
org.postgresql.util.PSQLException: ERROR: Geometry has Z dimension but column does not
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2161)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1890)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:560)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:417)
at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:363)
at com.springjdbc.jdbc.EutranCellGeoComputedInfoDAOImpl.save(EutranCellGeoComputedInfoDAOImpl.java:33)
at com.springjdbc.jdbc.SpringMain.main(SpringMain.java:48)
我正在使用 Preparestatement setObject 方法来设置 posgis 数据类型。
ps.setObject(2, cityinfo.getCellShape().toString(),java.sql.Types.OTHER);
ps.setObject(3, cityinfo.getCellLocation().toString(),java.sql.Types.OTHER);
表:
CREATE TABLE area_details_table
(
area geography(MultiPolygon,4326),
location geography(Point,4326),
calculated_cell_radius numeric(8,2),
latitude numeric(9,6),
longitude numeric(9,6),
id smallint,
)
需要帮助来解决此问题,或者是否有任何其他方法可以使用 Spring JDBC 保存 postgis 数据类型。
【问题讨论】:
标签: java postgresql postgis spring-jdbc