Error executing insert native query with upsert behavior using EntityManager after upgrading to Hibernate version 6.6.0.CR1

Description

After upgrading Hibernate from hibernate-core:6.5.3.Final to hibernate-core:6.6.0.CR1 (or any later versions), native queries that previously worked fine now fail with multiple double quotes around the GeoJSON string. This results in an error when trying to execute the query in PostgreSQL.

The following query works up to hibernate-core:6.6.0.Alpha1 version and fails after upgrading to 6.6.0.CR1 or above:

For this query, hibernate runs the following statement for versions above 6.0.0.Alpha1:

Which leads to the following exception:
[ERROR: unknown GeoJSON type] [n/a].

Whereas in previous versions, it would be executed correctly as the following statement:

 

Native queries with inserts and upsert behavior (ON CONFLICT treatments) are crucial for my application.

 

Edit.

It happens with JSON data in general, not just GeoJSON data types.

Steps to Reproduce:

  1. Upgrade Hibernate-core to 6.6.0.CR1 or above.

  2. Use the EntityManager.createNativeQuery(query).executeUpdate() method to execute the query with a $dollar$ quoted GeoJSON string.

  3. Observe that Hibernate generates the query with multiple double quotes, perharps it is what's causing the error.

relates to

Activity

Show:

Eduardo Nunes January 16, 2025 at 6:10 PM

It happens with JSON data in general, not just GeoJSON data types.

Eduardo Nunes January 6, 2025 at 5:01 PM

, done. Thanks!

Christian Beikov December 27, 2024 at 1:14 PM

Please try to create a reproducer with our test case template and if you are able to reproduce the issue, attach that reproducer.

Details

Assignee

Reporter

Labels

Components

Priority

Created December 17, 2024 at 6:24 PM
Updated last week