Hibernate Books

All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Internal handling of parameters in Hibernate Spatial vs Hibe
PostPosted: Mon May 22, 2017 8:57 am 
Newbie

Joined: Mon May 22, 2017 8:33 am
Posts: 3
Hi there,

we have a project setup with Hibernate 4 and Hibernate Spatial using a Postgresql database with the PostGIS extension. Currently we are migrating to Hibernate 5 and tackled some problems so far.
But now we ran into an issue with log messages provided by JDBCDSLOG. When previously using Hibernate 4 with Hibernate Spatial, JDBCDSLOG was logging geometries as WKT, this was possible as it received the SQL parameters for geometries as PGgeometry objects. With Hibernate 5 it receives these parameters as byte arrays and can only log a cryptic address like [B@1361cb3e).
We assume that this byte array is the reason for another problem we ran into by using the function buffer in JPQL statements:
Code:
org.postgresql.util.PSQLException: ERROR: function st_buffer(bytea, integer) is not unique
  Hinweis: Could not choose a best candidate function. You might need to add explicit type casts.

Is it possible to enforce Hibernate to use PGgeometry objects instead of byte arrays? If not we would be interested why the behaviour was changed?

Kind regards,

Marko Skocibusic


Top
 Profile  
 
 Post subject: Re: Internal handling of parameters in Hibernate Spatial vs Hibe
PostPosted: Mon May 22, 2017 9:05 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1386
I guess it's a mapping issue since Hibernate cannot resolve the type properly and it default to a byte array.

Did you add the hibernate-spatial dependency and are you using the PostgisPG9Dialect?

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Internal handling of parameters in Hibernate Spatial vs Hibe
PostPosted: Mon May 22, 2017 9:41 am 
Newbie

Joined: Mon May 22, 2017 8:33 am
Posts: 3
Hi Vlad,

thanks for your reply. We already have a dependency on hibernate spatial and use PostgisPG9Dialect. Furthermore I do not think that there is a problem with our mapping, as we do not have any problem with storing or loading our entities.

Kind regards,
Marko Skocibusic


Top
 Profile  
 
 Post subject: Re: Internal handling of parameters in Hibernate Spatial vs Hibe
PostPosted: Mon May 22, 2017 9:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1386
Then, you should debug the Hibernate 4 and 5 versions and see why 4 is working and 5 is not. You should also provide a test case and attach it to a new Jira issue.

Thanks

_________________
If you liked my answer, you are going to love my High-Performance Java Persistence book and my blog as well.


Top
 Profile  
 
 Post subject: Re: Internal handling of parameters in Hibernate Spatial vs Hibe
PostPosted: Tue May 23, 2017 7:18 am 
Newbie

Joined: Mon May 22, 2017 8:33 am
Posts: 3
Ok, I created an issue: HHH-11764.

Our problem is that Hibernate 4 bound JTS geometry parameters to the type PGgeometry and Hibernate 5 binds them to byte array.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.