We're updating the issue view to help you get more done. 

JTS geometry being bound to byte array instead of PGgeometry

Description

JTS geometry being bound to byte array instead of PGgeometry

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 ran into an issue with parameter binding.
In Hibernate 4 JTS geometries will be bound to type PGgeometry by org.hibernate.spatial.dialect.postgis.PGGeometryValueBinder in org.hibernate.spatial.dialect.AbstractJTSGeometryValueBinder#bind. But in Hibernate 5 JTS geometries will be converted to geolatte geometries which then are converted to a WKB, i.e. a byte array, and the parameter is bound to that byte array (all in org.hibernate.spatial.dialect.postgis.PGGeometryTypeDescriptor).
This causes two problems on our side. When using the function 'buffer' in a JPQL statement we get an error:

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.

And JDBCDSLOG, which we are using, cannot log geometry parameters as WKT anymore as it only receives a byte array.

Is it possible to enforce Hibernate to use PGgeometry objects instead of byte arrays? Or could the old behaviour of Hibernate 4 be reimplemented?

Kind regards,
Marko Skocibusic

Environment

Postgres DB with PostGIS extension

Status

Assignee

Karel Maesen

Reporter

Marko Skočibušić

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

backportDecision

None

Worked in

4.3.11

Components

Affects versions

5.2.10

Priority

Major