hibernate spatial - getSRID returning 0

Description

We are using Hibernate 5.0.7 under Wildfly 10.0.0 with Oracle 12c.

I have an entity mapping com.vividsolutions.jts.geom.Geometry to SDO_GEOMETRY using @org.hibernate.annotations.Type(type = "jts_geometry").
My database geometry value is MDSYS.SDO_GEOMETRY(3001,4979,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(-90,50,200))

getSRID on the returned object returns 0 instead of 4979. getCoordinates returns the expected data so that part is working fine.

Casting to Point did not make a difference. Using geolatte_geometry instead of jts_geometry resulted in getSRID returning -1.

Dependencies: geolatte-geom 1.0.1, jts 1.13, slf4j, oracle ojdbc7
persistence.xml has <property name="hibernate.dialect" value="org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect" />

Previously, getSRID worked as expected in hibernate 4.3 / wildfly 8 (same db).

Entity:

Test resource:

Create test record:
INSERT INTO LOCN (LOCN_ID, LOCN_GEOM)
VALUES (123456, MDSYS.SDO_GEOMETRY(3001,4979,NULL,MDSYS.SDO_ELEM_INFO_ARRAY(1,1,1),MDSYS.SDO_ORDINATE_ARRAY(-90,50,200)))

GET location:
curl localhost:8080/webapp/location?id=123456
For location 123456:
x = -90.0
y = 50.0
z = 200.0
SRID = 0

Environment

Hibernate 5.0.7, Oracle 12c

Activity

Show:
Karel Maesen
June 30, 2017, 2:06 PM

I think this is the same problem. Note that Hibernate Spatial works with the (standard) EPSG codes for spatial reference systems. 8307 is an Oracle specific SRID code for WGS84. In EPSG it's 4326.

If you don't use any of the special Oracle reference transformation or projection functions, you might be better of standardising on the EPSG codes.

Marco Tulio Avila Cerón
June 30, 2017, 2:38 PM

Hello Karel,

Thanks for your fast reply, yes, now works for me, my test code as follows:

Regards

~M

Elliott Richerson - NOAA Affiliate
July 7, 2017, 7:35 PM

Any idea when 5.2.11 will be available in any repository or for download?

Elliott Richerson - NOAA Affiliate
August 22, 2017, 4:13 PM

Does anybody know about the status of this going into an official release and the timeline? We have been waiting to fix this issue on one of our projects for several months now.

Karel Maesen
August 30, 2017, 5:21 PM

We expect the 5.2.11 release in september. That release will include the fix.

Fixed

Assignee

Karel Maesen

Reporter

Dawn Lenz

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure