지리 정보 데이터를 무시하고 MyBatis를 사용하여 PostGIS 데이터베이스에서 데이터를 쿼리하려고합니다. 나는 데이터베이스에 다음과 같은 테이블이 :MyBatis를 사용하여 PostGIS에서 열의 하위 집합을 어떻게 쿼리합니까?
CREATE TABLE salesgeometry
(
id bigint NOT NULL,
label character varying(255),
type character varying(255),
geom geometry,
CONSTRAINT salesgeometry_pkey PRIMARY KEY (id),
CONSTRAINT enforce_dims_geom CHECK (st_ndims(geom) = 2),
CONSTRAINT enforce_srid_geom CHECK (st_srid(geom) = 4326)
)
내가 MyBatis로이 주석을 사용하여이지도하기 위해 노력하고있어 :
public class Geometry {
private long id;
private String type;
private String label;
...
}
이 같은 필드가 있습니다
@Select("SELECT id, type, label FROM salesgeometry WHERE ST_Within(" +
"ST_GeomFromText('POINT(#{longitude} #{latitude})', 4326), geom) " +
"AND type = #{type}")
Geometry getGeometryAtLocation(
@NotNull @Param("type") String geometryType,
@NotNull @Param("longitude") BigDecimal longitude,
@NotNull @Param("latitude") BigDecimal latitude
);
그리고 대상 클래스를
불행히도 이것은 작동하지 않고 대신에
org.postgresql.util.PSQLException: The column index is out of range: 2, number of columns: 1.
데이터베이스의 열 하위 집합 만 쿼리하는 방법은 무엇입니까?