quarkus icon indicating copy to clipboard operation
quarkus copied to clipboard

Use SelectionQuery/MutationQuery wherever possible in Panache + avoid warning HHH000104

Open yrodiere opened this issue 1 year ago • 3 comments

  1. Moves to SelectionQuery/MutationQuery, which are the recommended way to create queries in Hibernate when using native APIs (Session).
    • Side effect: works around https://hibernate.atlassian.net/browse/HHH-18306 in the upcoming ORM 6.6 upgrade -- hopefully we won't care because the problem will be fixed in 6.6.0.Final, but it's convenient for me in my draft PR using 6.6.0.CR1.
  2. Fixes #41459

Migration guide entry:

== Hibernate ORM with Panache

=== Move to `SelectionQuery`/`MutationQuery`

Panache now relies on different methods to run queries:
instead of calling `Session#createQuery`, which returns a `Query` object,
Panache now calls `Session#createSelectionQuery`/`Session#createMutationQuery`,
which returns a `SelectionQuery`/`MutationQuery`.

This may affect applications in the following way:

* _Some_ exceptions thrown in case of misuse won't get wrapped anymore.
For example an invalid query `String` may result in a `SemanticException`,
whereas it used to result in an `IllegalArgumentException` whose cause was a `SemanticException`.
Exceptions thrown in case of unexpected database content are unaffected.
For example `NoResultException` will still be thrown as it used to be.
* Application tests using Panache and relying on a mocked `Session` may not work anymore,
until they adjust their mocking to mock `Session#createSelectionQuery`/`Session#createMutationQuery`
instead of `Session#createQuery`.

yrodiere avatar Jun 28 '24 10:06 yrodiere


:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.


Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 65355b3da78dab9e4541334db9824108e53d11f8.

:white_check_mark: The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

:warning: There are other workflow runs running, you probably need to wait for their status before merging.

quarkus-bot[bot] avatar Jun 28 '24 11:06 quarkus-bot[bot]


:waning_crescent_moon: This workflow status is outdated as a new workflow run has been triggered.


Status for workflow Quarkus Documentation CI

This is the status report for running Quarkus Documentation CI on commit 777f10c68bea19025d6cb80edf15a774e045066f.

:white_check_mark: The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

:warning: There are other workflow runs running, you probably need to wait for their status before merging.

quarkus-bot[bot] avatar Jun 28 '24 11:06 quarkus-bot[bot]

Status for workflow Quarkus CI

This is the status report for running Quarkus CI on commit f6630d10ab5f2ac28e52f47568d3756eb440d64f.

:white_check_mark: The latest workflow run for the pull request has completed successfully.

It should be safe to merge provided you have a look at the other checks in the summary.

You can consult the Develocity build scans.

quarkus-bot[bot] avatar Jun 28 '24 14:06 quarkus-bot[bot]

🙈 The PR is closed and the preview is expired.

github-actions[bot] avatar Jul 01 '24 08:07 github-actions[bot]