Can't convert object of type org.postgresql.util.PGobject

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Can't convert object of type org.postgresql.util.PGobject

jan.demoerloose
Hi,

i am getting the following error when using the
SpatialProjections.extent() projection to obtain the bounds of a layer:

java.lang.IllegalArgumentException: Can't convert object of type
org.postgresql.util.PGobject
     at
org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:114)
     at
org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
     at
org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:172)
     at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:132)
     at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:141)
     at
org.hibernate.loader.criteria.CriteriaLoader.getResultColumnOrRow(CriteriaLoader.java:138)
     at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:647)
     at org.hibernate.loader.Loader.doQuery(Loader.java:745)
     at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
     at org.hibernate.loader.Loader.doList(Loader.java:2294)
     at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
     at org.hibernate.loader.Loader.list(Loader.java:2167)
     at
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
     at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
     at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
     at
org.geomajas.layer.hibernate.HibernateLayer.getBounds(HibernateLayer.java:314)

The code is straightforward:
              Session session = getSessionFactory().getCurrentSession();
             Criteria criteria = session.createCriteria("layer");
              ...
             criteria.setProjection(SpatialProjections.extent("layer"));
             Object geometry = criteria.uniqueResult();

The generated sql looks like this:
select extent(this_.geom) as y0_ from reference_base this_ where (1=1
and (this_.geom && ? AND intersects(this_.geom, ?)))

 From a previous post i know this may have something to do with the
postgis drivers, but i can query the layer without a problem.
This is my effective pom:

<dependency>
<groupId>org.hibernatespatial</groupId>
<artifactId>hibernate-spatial-postgis</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>1.3.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.4-701.jdbc3</version>
<scope>compile</scope>
</dependency>

Any ideas ?

Jan
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Can't convert object of type org.postgresql.util.PGobject - SpatialProjections.extent()

Nikolai Bock
Hi,

I'm replying to this post, because I have the same problem as Jan.
I'm working with the same postgresql and postgis artifacts and with hibernate-spatial-postgis 1.1

Normal requests with spatial filter operations (SpatialRefractions) will work well, but when I want to get the extent by using SpatialProjections I'm getting the same error like Jan.

@Jan: You've found a solution for your problem?

@all: Has anyone an idea?

Regards
Nikolai

jan.demoerloose wrote
Hi,

i am getting the following error when using the
SpatialProjections.extent() projection to obtain the bounds of a layer:

java.lang.IllegalArgumentException: Can't convert object of type
org.postgresql.util.PGobject
     at
org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:114)
     at
org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
     at
org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:172)
     at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:132)
     at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:141)
     at
org.hibernate.loader.criteria.CriteriaLoader.getResultColumnOrRow(CriteriaLoader.java:138)
     at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:647)
     at org.hibernate.loader.Loader.doQuery(Loader.java:745)
     at
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
     at org.hibernate.loader.Loader.doList(Loader.java:2294)
     at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
     at org.hibernate.loader.Loader.list(Loader.java:2167)
     at
org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
     at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
     at org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
     at
org.geomajas.layer.hibernate.HibernateLayer.getBounds(HibernateLayer.java:314)

The code is straightforward:
              Session session = getSessionFactory().getCurrentSession();
             Criteria criteria = session.createCriteria("layer");
              ...
             criteria.setProjection(SpatialProjections.extent("layer"));
             Object geometry = criteria.uniqueResult();

The generated sql looks like this:
select extent(this_.geom) as y0_ from reference_base this_ where (1=1
and (this_.geom && ? AND intersects(this_.geom, ?)))

 From a previous post i know this may have something to do with the
postgis drivers, but i can query the layer without a problem.
This is my effective pom:

<dependency>
<groupId>org.hibernatespatial</groupId>
<artifactId>hibernate-spatial-postgis</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>1.3.3</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.4-701.jdbc3</version>
<scope>compile</scope>
</dependency>

Any ideas ?

Jan
_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Can't convert object of type org.postgresql.util.PGobject - SpatialProjections.extent()

jan.demoerloose
On 21/09/2011 15:30, Nikolai Bock wrote:

> Hi,
>
> I'm replying to this post, because I have the same problem as Jan.
> I'm working with the same postgresql and postgis artifacts and with
> hibernate-spatial-postgis 1.1
>
> Normal requests with spatial filter operations (SpatialRefractions) will
> work well, but when I want to get the extent by using SpatialProjections I'm
> getting the same error like Jan.
>
> @Jan: You've found a solution for your problem?
No, i just posted an issue:
http://www.hibernatespatial.org/jira/browse/HIBSPA-91

> @all: Has anyone an idea?
>
> Regards
> Nikolai
>
>
> jan.demoerloose wrote:
>> Hi,
>>
>> i am getting the following error when using the
>> SpatialProjections.extent() projection to obtain the bounds of a layer:
>>
>> java.lang.IllegalArgumentException: Can't convert object of type
>> org.postgresql.util.PGobject
>>       at
>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:114)
>>       at
>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
>>       at
>> org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:172)
>>       at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:132)
>>       at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:141)
>>       at
>> org.hibernate.loader.criteria.CriteriaLoader.getResultColumnOrRow(CriteriaLoader.java:138)
>>       at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:647)
>>       at org.hibernate.loader.Loader.doQuery(Loader.java:745)
>>       at
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>>       at org.hibernate.loader.Loader.doList(Loader.java:2294)
>>       at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
>>       at org.hibernate.loader.Loader.list(Loader.java:2167)
>>       at
>> org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
>>       at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
>>       at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
>>       at
>> org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
>>       at
>> org.geomajas.layer.hibernate.HibernateLayer.getBounds(HibernateLayer.java:314)
>>
>> The code is straightforward:
>>                Session session = getSessionFactory().getCurrentSession();
>>               Criteria criteria = session.createCriteria("layer");
>>                ...
>>               criteria.setProjection(SpatialProjections.extent("layer"));
>>               Object geometry = criteria.uniqueResult();
>>
>> The generated sql looks like this:
>> select extent(this_.geom) as y0_ from reference_base this_ where (1=1
>> and (this_.geom&&  ? AND intersects(this_.geom, ?)))
>>
>>   From a previous post i know this may have something to do with the
>> postgis drivers, but i can query the layer without a problem.
>> This is my effective pom:
>>
>> <dependency>
>> <groupId>org.hibernatespatial</groupId>
>> <artifactId>hibernate-spatial-postgis</artifactId>
>> <version>1.0</version>
>> <scope>compile</scope>
>> </dependency>
>> <dependency>
>> <groupId>org.postgis</groupId>
>> <artifactId>postgis-jdbc</artifactId>
>> <version>1.3.3</version>
>> <scope>compile</scope>
>> </dependency>
>> <dependency>
>> <groupId>postgresql</groupId>
>> <artifactId>postgresql</artifactId>
>> <version>8.4-701.jdbc3</version>
>> <scope>compile</scope>
>> </dependency>
>>
>> Any ideas ?
>>
>> Jan
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>>
>
> --
> View this message in context: http://hibernate-spatial.1140993.n2.nabble.com/Can-t-convert-object-of-type-org-postgresql-util-PGobject-tp6230980p6816010.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-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Reply | Threaded
Open this post in threaded view
|

Re: Can't convert object of type org.postgresql.util.PGobject - SpatialProjections.extent()

Karel Maesen
Administrator
Hi,

I will try to get a fix in trunk (1.1.1) for this. Shouldn't be too difficult.

Sorry Jan, I lost track of you earlier message.

Regards,

Karel



On 22 Sep 2011, at 10:37, [hidden email] wrote:

> On 21/09/2011 15:30, Nikolai Bock wrote:
>> Hi,
>>
>> I'm replying to this post, because I have the same problem as Jan.
>> I'm working with the same postgresql and postgis artifacts and with
>> hibernate-spatial-postgis 1.1
>>
>> Normal requests with spatial filter operations (SpatialRefractions) will
>> work well, but when I want to get the extent by using SpatialProjections I'm
>> getting the same error like Jan.
>>
>> @Jan: You've found a solution for your problem?
> No, i just posted an issue:
> http://www.hibernatespatial.org/jira/browse/HIBSPA-91
>> @all: Has anyone an idea?
>>
>> Regards
>> Nikolai
>>
>>
>> jan.demoerloose wrote:
>>> Hi,
>>>
>>> i am getting the following error when using the
>>> SpatialProjections.extent() projection to obtain the bounds of a layer:
>>>
>>> java.lang.IllegalArgumentException: Can't convert object of type
>>> org.postgresql.util.PGobject
>>>      at
>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:114)
>>>      at
>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
>>>      at
>>> org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:172)
>>>      at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:132)
>>>      at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:141)
>>>      at
>>> org.hibernate.loader.criteria.CriteriaLoader.getResultColumnOrRow(CriteriaLoader.java:138)
>>>      at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:647)
>>>      at org.hibernate.loader.Loader.doQuery(Loader.java:745)
>>>      at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
>>>      at org.hibernate.loader.Loader.doList(Loader.java:2294)
>>>      at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2172)
>>>      at org.hibernate.loader.Loader.list(Loader.java:2167)
>>>      at
>>> org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:119)
>>>      at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1706)
>>>      at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:347)
>>>      at
>>> org.hibernate.impl.CriteriaImpl.uniqueResult(CriteriaImpl.java:369)
>>>      at
>>> org.geomajas.layer.hibernate.HibernateLayer.getBounds(HibernateLayer.java:314)
>>>
>>> The code is straightforward:
>>>               Session session = getSessionFactory().getCurrentSession();
>>>              Criteria criteria = session.createCriteria("layer");
>>>               ...
>>>              criteria.setProjection(SpatialProjections.extent("layer"));
>>>              Object geometry = criteria.uniqueResult();
>>>
>>> The generated sql looks like this:
>>> select extent(this_.geom) as y0_ from reference_base this_ where (1=1
>>> and (this_.geom&&  ? AND intersects(this_.geom, ?)))
>>>
>>>  From a previous post i know this may have something to do with the
>>> postgis drivers, but i can query the layer without a problem.
>>> This is my effective pom:
>>>
>>> <dependency>
>>> <groupId>org.hibernatespatial</groupId>
>>> <artifactId>hibernate-spatial-postgis</artifactId>
>>> <version>1.0</version>
>>> <scope>compile</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>org.postgis</groupId>
>>> <artifactId>postgis-jdbc</artifactId>
>>> <version>1.3.3</version>
>>> <scope>compile</scope>
>>> </dependency>
>>> <dependency>
>>> <groupId>postgresql</groupId>
>>> <artifactId>postgresql</artifactId>
>>> <version>8.4-701.jdbc3</version>
>>> <scope>compile</scope>
>>> </dependency>
>>>
>>> Any ideas ?
>>>
>>> Jan
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>>>
>>
>> --
>> View this message in context: http://hibernate-spatial.1140993.n2.nabble.com/Can-t-convert-object-of-type-org-postgresql-util-PGobject-tp6230980p6816010.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-users
>
> _______________________________________________
> 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