views:

124

answers:

1

Hello

I am using Glassfish v2, Hibernate with Annotations+EntityManager and Postgresql 8.4. I am also using on top HibernateSpatial and PostGis. It works fine to persist entities with spatial properties ( com.vividsolutions.jts.geom.Point ) into the Postgis database.

However, when trying to fetch objects using myEntityManager.find(MyClass.class, key), I have the following exception :
Can't convert object of type org.postgresql.util.PGobject

I am not sure, but googling around, it seems that the connection pool that I use to access the Postgres database lacks an org.postgis.DriverWrapper, and this is why the database PGobject corresponding to the Point property can not be converted back.

I can't find how to add this wrapper to the connection pool. Can someone explain how to configure a connection pool for a PostGis connection ? Or indicate if this exception comes from another error ?

Thank you Tartox

A: 

For anyone interested, the problem was that the postgis.jar was missing in the Glassfish lib along with the postgres.jdbc.jar.