I'm having a problem while using H2 and GeoDB (in-memory, junit).
Also, using Hibernate 5 (latest versions for each package, including hibernate-spatial) and Spring 4.
Persisting and querying by id entities works just fine. Geometry types are recognized without problems.
Problems arise when I try to query the DB with geospatial functions, and Hibernate fails saying that he can't find the function:
[ERROR] 2015-12-16 11:16:15,000: org.hibernate.engine.jdbc.spi.SqlExceptionHelper.logExceptions:129: Function "ST_CONTAINS" not found; SQL statement:
select geoentity0_.id as id1_0_, geoentity0_.location as location2_0_, geoentity0_.name as name3_0_ from GEO_ENTITY geoentity0_ where ST_Contains(geoentity0_.location, ?)=1 [90022-190]
Looks like a probem of dialect.Here is what I'm using (in persistence.xml):
<property name="hibernate.dialect" value="org.hibernate.spatial.dialect.h2geodb.GeoDBDialect" />
These are the deps I'm using:
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>1.4.190</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.opengeo</groupId>
<artifactId>geodb</artifactId>
<version>0.7</version>
<scope>test</scope>
</dependency>
What am I doing wrong and how can I fix?
EDIT: Adding h2gis
I've tried adding h2gis
to my deps but didn't change the error. I've also tried to substitute geodb
with h2gis
, with the same result.
<dependency>
<groupId>org.orbisgis</groupId>
<artifactId>h2spatial-ext</artifactId>
<version>1.2.3</version>
</dependency>