"package org.postgresql.util does not exist" compilation problem

Поиск
Список
Период
Сортировка
От Santiago Álvarez Martínez
Тема "package org.postgresql.util does not exist" compilation problem
Дата
Msg-id COL118-W2B594CA20F63BB3799519CBAE0@phx.gbl
обсуждение исходный текст
Ответы Re: "package org.postgresql.util does not exist" compilation problem  (Craig Ringer <craig@postnewspapers.com.au>)
Список pgsql-general

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.

В списке pgsql-general по дате отправления:

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: Re: deleting db cluster
Следующее
От: David R Robison
Дата:
Сообщение: PG 8.4 won't start on Windows Server 2008 64-bit