-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question mark not escaped in a query (using PostgreSQL JSON data) #2012
Comments
Doesn't this work?
|
I just tried it in Hibernate ORM 7, and |
Thanks for all your answers. I confirm that it works with hibernate ORM but not with Hibernate Reactive.
The #3 work with Hibernate ORM. I attached the reproducers I hope it can help :) code-with-quarkus-postgres.zip You can run ITs with the command: |
Thanks for the tests! I think what's happening is that Hibernate Reactive receives the query after Hibernate ORM already did some transformation to it. I'm having a look. |
As a workaround, this should work: jsonb_content -> 'key1' \\\\\\? 'k123' |
I think at the moment the workaround I suggested is the easiest way to solve this issue. The problem is that Hibernate ORM doesn't replace parameters markers for native queries (HHH-16283). So we need to still run our parameter processor to replace the I think we should wait until HHH-16283 has been solved. And then we can remove the extra processing of the query. I'm open to suggestions though. |
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * Fix hibernate#201: ReactiveIdentifierGenerator must extends Generator * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * Fix hibernate#1826: ReactiveIdentifierGenerator must extends Generator * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * Fix hibernate#1826: ReactiveIdentifierGenerator must extends Generator * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * Fix hibernate#1826: ReactiveIdentifierGenerator must extends Generator * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Notes: * Fix #1826: ReactiveIdentifierGenerator must extends Generator * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See #2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See #1999
Notes: * Fix hibernate#1826: ReactiveIdentifierGenerator must extends Generator * The Hibernate Gradle plugin has not been released yet, so we keep it to 7.0.0.Beta2 * XML sql data type is not supported: eclipse-vertx/vertx-sql-client#1475 * Stop using `org.hibernate.dialect.DialectDelegateWrapper` (not required anymore) * Remove `ReactiveOracleSqlAstTranslator` (not required anymore) * Only process parameters for native queries. See hibernate#2012 * Remove `ReactiveIdentifierGeneratorFactory`: the service doesn't exist anymore in ORM * Add `persist(String, Object)` to the session * Remove test for `hibernate.create_empty_composites.enabled`: see [HHH-18222](https://hibernate.atlassian.net/browse/HHH-18222) * Contains some clean ups * There are still some issues with embeddable mapped as JSON and native queries: See hibernate#1999
Hello,
I tried to do a query on a PostgresSQL database with JSON content, something like:
select * from mytable where mytable -> 'myelement' ? 'key123';
It doesn't work as this in a native query because the question mark is interpreted as a parameter.
I searched for help on this and apparently, the question mark could be escaped using one of:
??
to escape in JDBC\\?\\?
to escape in HibernateNone of those 2 solutions worked but should it really work ? I didn't see anything about this in the documentation... may be I missed something.
If escaping the character is not an acceptable solution, may be it is possible to add a parameter in a future version to disable the "JDBC-style parameters" and force to use
:myparam
or?1
?I saw in the documentation that "JDBC-style parameters" have a skull head, it probably means it is a devil feature or at least a feature that we should not use so optionally not interpreting this seems to be an acceptable solution ?
As a reference, the same issue fixed in Spring Data JPA: spring-projects/spring-data-jpa#2551
Quarkus: 3.15.1
Hibernate Reactive: 2.4.0
Thank you for your help.
The text was updated successfully, but these errors were encountered: