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):
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.