GeoLatte / geolatte-geom

A geometry model that conforms to the OGC Simple Features for SQL specification.
Other
134 stars 63 forks source link

java.lang.ArrayStoreException: java.lang.Double - MDSYS .SDO_POINT_TYPE #72

Closed sumashankar closed 6 years ago

sumashankar commented 6 years ago

geolatte-geom : 1.1.0 hibernate-spatial : 5.0.12.Final DB : Oracle

I am trying to store the x,y points as SDO_POINT instead of array elements

Example Instead of this ( MDSYS.SDO_GEOMETRY(2001, 27700, NULL, MDSYS.SDO_ELEM_INFO_ARRAY(1, 1, 1), MDSYS.SDO_ORDINATE_ARRAY(480000, 521000)) ) i would like to store it has MDSYS.SDO_GEOMETRY(2001,27700,MDSYS.SDO_POINT_TYPE(480000,521000,NULL),NULL,NULL) )

I have followed the steps as mentioned in https://stackoverflow.com/questions/35898403/storing-geometries-as-sdo-point-type-with-hibernate-5-and-oracle and set system property GEOLATTE_USE_SDO_POINT_TYPE to true

Now it is throwing exception java.lang.ArrayStoreException: java.lang.Double.

I think the root cause is on File OracleJDBCTypeFactory.java method : createStruct which is expecting the x,y coordinates as object array instead of double

if (geom.getPoint() != null) { Object pointStructDescriptor = this.createStructDescriptor(SDOGeometry.getPointTypeName(), oracleConnection); Object[] pointAttributes = this.createDatumArray(3); SDOPoint sdoPnt = geom.getPoint(); pointAttributes[0] = sdoPnt.x; pointAttributes[1] = sdoPnt.y; pointAttributes[2] = sdoPnt.z; attributes[2] = this.createStruct(pointStructDescriptor, oracleConnection, pointAttributes); }

maesenka commented 6 years ago

This is a duplicate of issue #67, and has been fixed in commit 23d1b62