I use maven to manage my project libraries dependencies and from the maven quick start page configuration (
http://www.hibernatespatial.org/mavenquick.html ) the following pertinent libraries were downloaded:
hibernate-3.2.6.ga.jar
hibernate-spatial-1.0-M2.jar
hibernate-spatial-postgis-1.0-M2.jar
postgresql-8.1-407.jdbc3.jar
postgis-jdbc-1.1.6.jar
below follows my pom.xml if you want to give maven a try. You can always download the libraries with maven and import them into your current project.
I use the EntityManager library, so there is much stuff associated with it. You can try building a simpler pom.xml using this as a base, just remember to copy the repositories.
Regards,
Alexandre Pretyman
==== Pom.xml BEGIN ===========================
<project xmlns="
http://maven.apache.org/POM/4.0.0" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>br.com.m2msolutions</groupId>
<artifactId>FrotaSE</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>GisProjectTest</name>
<url>
http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>2.5-RC1</version>
</dependency>
<dependency>
<groupId>org.hibernatespatial</groupId>
<artifactId>hibernate-spatial-postgis</artifactId>
<version>1.0-M2</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-annotations</artifactId>
<version>3.3.1.GA</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>3.3.2.GA</version>
</dependency>
<dependency>
<groupId>c3p0</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.1.2</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<exclusions>
<exclusion>
<groupId>com.sun.jdmk</groupId>
<artifactId>jmxtools</artifactId>
</exclusion>
<exclusion>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</exclusion>
<exclusion>
<groupId>javax.jms</groupId>
<artifactId>jms</artifactId>
</exclusion>
<exclusion>
<groupId>com.sun.jmx</groupId>
<artifactId>jmxri</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
<!-- =========================================================== -->
<!-- Repositories (ibiblio, refractions...). -->
<!-- This is where Maven looks for dependencies. -->
<!-- =========================================================== -->
<repositories>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>ibiblio</id>
<name>Ibiblio - the public's library and digital archive</name>
<url>
http://www.ibiblio.org/maven2</url>
</repository>
<repository>
<id>refractions</id>
<name>Refractions Research Maven 2 Repository</name>
<url>
http://lists.refractions.net/m2</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>geotools</id>
<name>Geotools repository</name>
<url>
http://maven.geotools.fr/repository</url>
</repository>
<repository>
<snapshots>
<enabled>false</enabled>
</snapshots>
<id>central</id>
<name>Maven Repository Switchboard</name>
<url>
http://repo1.maven.org/maven2</url>
</repository>
<repository>
<id>Hibernate Spatial repo</id>
<url>
http://www.hibernatespatial.org/repository</url>
</repository>
<repository>
<id>JBoss</id>
<url>
http://repository.jboss.com/maven2</url>
</repository>
</repositories>
</project>
==== Pom.xml END ===========================
-----Original Message-----
From:
[hidden email] [mailto:
[hidden email]] On Behalf Of Jo_
Sent: quarta-feira, 17 de setembro de 2008 13:03
To:
[hidden email]
Subject: Re: [hibernatespatial-users] Can't convert object of type org.postgresql.util.PGobject
Ok...
I think I get closer...
I print out the postgres driver version:
PostgreSQL 8.0devel JDBC3 with SSL (build 309)
I don't know where it is. I've placed the newer one in the classpath but
eclipse/java
does't use this for org.postgresql.Driver .
The exception get threw for example the .list() method on my query.
Alexandre Walter Pretyman-2 wrote:
>
> Try with a jdbc3 driver, and let us know
>
> -----Original Message-----
> From:
[hidden email]
> [mailto:
[hidden email]] On
> Behalf
> Of Jo_
> Sent: terça-feira, 16 de setembro de 2008 11:08
> To:
[hidden email]
> Subject: Re: [hibernatespatial-users] Can't convert object of type
> org.postgresql.util.PGobject
>
>
> Sorry, my last reply doesn't followed the thread.
>
> I use the
http://jdbc.postgresql.org/download/postgresql-8.3-603.jdbc4.jar> driver.
> Java 1.6 to connect to the database. The connection to the db without
> hibernate and with hibernate is no problem. The problem only occurs when I
> try to load an object from the spatial db.
>
>
> There are my settings from the hibernate.properties file:
>
> hibernate.connection.driver_class=org.postgis.DriverWrapper
> hibernate.dialect=org.hibernatespatial.postgis.PostgisDialect
> hibernate.connection.url=jdbc:postgresql://localhost/mydatabase
>
> Jo
>
>
> Andy Bailey-2 wrote:
>>
>> Jo,
>>
>> It may be that you are using the wrong driver to connect to the
>> database. Can you post the hibernate configuration for the driver you
>> are using.
>>
>> Andy Bailey
>>
http://www.hazlorealidad.com>>
>> On Mon, 2008-09-15 at 13:14 +0200, Johannes Lauer wrote:
>>> Hi,
>>>
>>> when I do a query on my postgres/postgis database and try to save it in
>>> a
>>> List (like in the tutorial on
>>> the hibernate spatial website) there comes an Exception:
>>>
>>> Exception in thread "main" java.lang.IllegalArgumentException: Can't
>>> convert object of type org.postgresql.util.PGobject
>>> at
>>>
> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserTy
> pe.java:123)
>>> at
>>>
> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryTy
> pe.java:127)
>>> at
>>>
> org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:170)
>>> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:128)
>>> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:105)
>>> at
>>>
> org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntit
> yPersister.java:2124)
>>> at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1404)
>>> at
> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1332)
>>> at org.hibernate.loader.Loader.getRow(Loader.java:1230)
>>> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:603)
>>> at org.hibernate.loader.Loader.doQuery(Loader.java:724)
>>> at
>>>
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.ja
> va:259)
>>> at org.hibernate.loader.Loader.doList(Loader.java:2228)
>>> at
> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
>>> at org.hibernate.loader.Loader.list(Loader.java:2120)
>>> at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:401)
>>> at
>>>
> org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:361)
>>> at
>>>
> org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:196)
>>> at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1148)
>>> at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
>>> at
> communication.postgresDB.PGGpsDBIO.retrieveTrk(PGGpsDBIO.java:191)
>>> at util.test.HibernateTester.main(HibernateTester.java:51)
>>>
>>> I've found a similar post on the mailing list but nothing I've done
>>> solved the problem.
>>>
>>> I'm using
>>> hibernate 3.3.0SP1
>>> hibernate spatial 1.0M2
>>> hibernate-spatial-postgis-1.0-M2
>>> hibernate-annotations 3.4.0.GA
>>> postgis 1.4.0
>>> postgres 8.3
>>>
>>> Kind Regards,
>>>
>>> Jo
>>>
>>>
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>>
[hidden email]
>>
>
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-us> ers
>>
>>
>
> --
> View this message in context:
>
http://www.nabble.com/Can%27t-convert-object-of-type-org.postgresql.util.PGo> bject-tp19491034p19512621.html
> Sent from the Hibernate Spatial - Users mailing list archive at
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
>
[hidden email]
>
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-us> ers
>
> _______________________________________________
> hibernatespatial-users mailing list
>
[hidden email]
>
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users>
>
--
View this message in context:
http://www.nabble.com/Can%27t-convert-object-of-type-org.postgresql.util.PGobject-tp19491034p19535508.htmlSent from the Hibernate Spatial - Users mailing list archive at Nabble.com.
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users