Hi: I'm developing a Java application, using Maven, Spring and Hibernate, and Postgre (with Postgis) as DBMS. Everything went OK, until I had to import the org.postgresql.util package, to use the PGobject class, in a UserType Hibernate class. I got the following errors: [...] [loading org/postgis/Geometry.class(org/postgis:Geometry.class)] [loading org/postgis/binary/BinaryParser.class(org/postgis/binary:BinaryParser.class)] [loading org/postgis/binary/BinaryWriter.class(org/postgis/binary:BinaryWriter.class)] /home/perseo/PFC/maven.1264475335794/src/main/java/es/udc/fiestas/model/util/types/PointType.java:15: package org.postgresql.util does not exist import org.postgresql.util.PGobject; ^ [...] [checking es.udc.fiestas.web.pages.usuario.CambiarUbicacion] [checking es.udc.fiestas.model.util.types.PointType] /home/perseo/PFC/maven.1264475335794/src/main/java/es/udc/fiestas/model/util/types/PointType.java:56: cannot find symbol symbol : class PGobject location: class es.udc.fiestas.model.util.types.PointType PGobject pgo = (PGobject) rs.getObject(names[0]); ^ /home/perseo/PFC/maven.1264475335794/src/main/java/es/udc/fiestas/model/util/types/PointType.java:[56,24] cannot find symbol symbol : class PGobject location: class es.udc.fiestas.model.util.types.PointType In my pom.xml file, I've included the dependencies for both Postgre and Postgis, and Eclipse doesn't complain about them (neither in the pom.xml file, nor in the PointType.java): <!-- PostgreSQL --> <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>8.4-701.jdbc4</version> </dependency> <!-- PostGIS --> <dependency> <groupId>org.postgis</groupId> <artifactId>postgis-jdbc</artifactId> <version>1.3.3</version> </dependency> Is there any issue with Postgre JDBC that doesn't allow to use their classes like any other package? Note: I have to import that class, to be used here: public Object nullSafeGet(ResultSet rs, String[] names, Object owner) throws HibernateException, SQLException { PGobject pgo = (PGobject) rs.getObject(names[0]); BinaryParser bp = new BinaryParser(); return (Point) bp.parse(pgo.getValue()); } As the returned object is a PGobject (from a Geometry Postgis column), I use the PGobject getValue() method to access its content, so I can't generalize that. Thank you in advance. Nice regards. Santiago. |