Hi all.
I'm a beginner of spatial queries and entities (so please forgive me if the 
question is silly) and need to use it for a project I'm working on. So far, 
I've set up the generic environment, then started building the JUnit one, 
with the purpose of using an in-memory DB (thing which I've done a fair 
amount of times, but this the first time I have to with spatial-queries and 
extensions).

So far, persisting and retrieving (by id) entities work fine, I got 
problems when quering the DB with spatial functions.
The error I get is:
[ERROR] 2015-12-16 13:27:35,164: 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]

Here are some code snippets of what I've done so far.

*POM.xml*
<dependency>
    <groupId>org.hibernate</groupId>
    <artifactId>hibernate-spatial</artifactId>
    <version>5.0.5.Final</version>
    <exclusions>
        <exclusion>
            <groupId>org.hibernate</groupId>
            <artifactId>*</artifactId>
        </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.4.190</version>
    <scope>test</scope>
</dependency>
<dependency>
    <groupId>org.orbisgis</groupId>
    <artifactId>h2gis</artifactId>
    <version>1.2.3</version>
    <type>pom</type>
    <scope>test</scope>
</dependency>


*persistence.xml*
<persistence 
    xmlns="http://java.sun.com/xml/ns/persistence"; xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance";
    version="2.0" 
    xsi:schemaLocation="
        http://java.sun.com/xml/ns/persistence 
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd";>
    <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL">
        <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
        <class>org.jcz.persistence.ogc.jpa.model.GeoEntity</class>
        <exclude-unlisted-classes>true</exclude-unlisted-classes>
        <properties>
            <property name="hibernate.connection.url" value=
"jdbc:h2:mem:test;DB_CLOSE_DELAY=-1" />
            <property name="hibernate.connection.driver_class" value=
"org.h2.Driver" />
            <property name="hibernate.dialect" value=
"org.hibernate.spatial.dialect.h2geodb.GeoDBDialect" />
            <property name="hibernate.hbm2ddl.auto" value="create-drop" />
            <property name="hibernate.show_sql" value="true"/>
            <property name="hibernate.format_sql" value="true"/>
        </properties>
    </persistence-unit>
</persistence>

Can anyone explains me what I'm doing wrong?

Thanks,
Stefano

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to