I am currently working with a colleague in transfering a Java application over to use Hibernate 4. As part of that work, we need to be able to load Ocracle geometry data into the Java application. However, when we try and load the geometry, we get a UnsupportedOperationException from Hibernate Spatial, specifcally this error:

Caused by: java.lang.UnsupportedOperationException
at org.hibernate.spatial.GeometrySqlTypeDescriptor.getExtractor(GeometrySqlTypeDescriptor.java:57)  

This is the column definition for the variable holding the geometry:

@Type(type="org.hibernate.spatial.GeometryType") private Geometry ordinates;

I've examined the hibernate query and all seems fine with that. We are using Hibernate 4.2.2, Hibernate Spatial 4.0-M1 and JTS 1.8. The database is Oracle 11g.

Thanks in advance.

有帮助吗?

解决方案

I've worked out the answer. The problem is due to the configuration of the dialet for Hibernate. The dialect that should be used is this:

config = config.setProperty(Environment.DIALECT, "org.hibernate.spatial.dialect.oracle.OracleSpatial10gDialect")

Rather than this one:

config = config.setProperty(Environment.DIALECT, "org.hibernate.dialect.Oracle10gDialect")

The error message isn't entirely clear on that one but this will hopefully solve anyone else having this problem.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top