我正在用 Java 开发一个带有 oracle 空间的位置应用程序。我正在使用休眠 4.0 空间作为 orm 层。我是空间新手,我找不到休眠空间的最佳实践。我的数据库模型如下;
CREATE TABLE SYSTEM.POI (
POI_ID INTEGER,
SERVICE_ID INTEGER,
POI_NAME VARCHAR2(255 CHAR),
DESCRIPTION VARCHAR2(1023 CHAR),
CATEGORY VARCHAR2(127 CHAR),
ADDRESS VARCHAR2(4000 CHAR),
MOBILE_PHONE VARCHAR2(15 CHAR),
FIXED_PHONE VARCHAR2(15 CHAR),
BUSINESS_HOURS VARCHAR2(1023 CHAR),
SHAPE SDO_GEOMETRY
)
插入语句如下;
INSERT INTO SYSTEM.POI (SERVICE_ID, POI_NAME, DESCRIPTION, CATEGORY, ADDRESS, MOBILE_PHONE, FIXED_PHONE, BUSINESS_HOURS, SHAPE)
VALUES(
'1320',
'PO-Kral Petrol Ürünleri San ve Tic. Ltd. şti.',
'Camilerimiz',
'CAMI',
'İSLİCE MAHALLESİ DERE SOKAK NO:5',
'2762151093',
'5552552343',
'Hafta içi 09:00 - 17:00, haftasonu 09:00 - 13:00 açık',
SDO_GEOMETRY(
2001,
3785,
SDO_POINT_TYPE(28.90762, 41.1521, NULL),
NULL,
NULL
)
);
实体模型跟随我只共享 sdo_geometry 对象;
import com.vividsolutions.jts.geom.Geometry;
...
@Column(name="SHAPE")
@Type(type = "org.hibernatespatial.GeometryUserType")
private Geometry shape;
public Geometry getShape() {
return shape;
}
public void setShape(Geometry shape) {
this.shape = shape;
}
如何用动态参数填充这个 spahe 对象。例如;
SDO_GEOMETRY(
2001, --> sdo_gtype
3785, --> sdo_srid
SDO_POINT_TYPE(28.90762, 41.1521, NULL), --> sdo_point
NULL, --> sdo_elem_info
NULL --> sdo_ordinates
)
如何动态地将 sdo_gtype、sdo_srid、sdo_point_type 参数传递给几何对象?