Native query with parameter marker

XMLWordPrintableJSON

    • Type: New Feature
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Query
    • None
    • 5
    • None
    • Needed
    • Hide

      Complexity: Medium (support flip plus several syntax caveats and new examples)

      Feature Compatibility: mark "Native Querying with MQL", including parameter binding, as supported. Caveats: native queries must use MongoDB Extended JSON syntax only; single-quoted strings and shell-style /regex/ are not supported (use $regularExpression); scalar and multivalued parameters both supported. Add parameter-binding examples to the Perform Native Database Queries guide, including one where the parameter is a list within a $in query.

      Show
      Complexity: Medium (support flip plus several syntax caveats and new examples) Feature Compatibility: mark "Native Querying with MQL", including parameter binding, as supported. Caveats: native queries must use MongoDB Extended JSON syntax only; single-quoted strings and shell-style /regex/ are not supported (use $regularExpression ); scalar and multivalued parameters both supported. Add parameter-binding examples to the Perform Native Database Queries guide, including one where the parameter is a list within a $in query.
    • None
    • None
    • None
    • None
    • None
    • None

      As we flushed out in POC project, currently Hibernate hard-codes `?` as the only parameter marker for native query; but we require customized parameter marker (using {$undefined: true}) to work consistently with MQL generated via AST translation.

      It has a long history and Hibernate side won't fix it soon for good reasons. We might need to figure out how to work around it. The easiest one is simply parse `?` as native query marker, as what has been done in Hibernate Reactive codebase (https://github.com/hibernate/hibernate-reactive/blob/main/hibernate-reactive-core/src/main/java/org/hibernate/reactive/pool/impl/Parameters.java).

      Note that Hibernate 7.1 allows configuring a custom parameter marker for native queries: https://hibernate.atlassian.net/browse/HHH-16283.

            Assignee:
            Almas Abdrazak
            Reporter:
            Nathan Xu (Inactive)
            Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: