HHH-19472: native queries can return Object[] #10178
Open
+145
−56
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The fix is quite simple and obvious. I also refactored the test that was previously introduced for HHH-18450 to cover more cases and make it easier to maintain.
My understanding is that when executing queries (any kind), we either provide a row transformer, a tuple transformer or the expected result class. Sqm-based queries are providing the row transformer directly (based on the result class) while native queries are currently implemented with providing directly the tuple transformer.
So I went with fitting in the existing code by supporting
Object[]
at the tuple transformer level for native queries.Alternatively I looked into producing a row transformer in
NativeSelectQueryPlanImpl
or moving all the default row transformer instantiation (that can be found in a few places of the codebase, e.g.,ConcreteSqmSelectQueryPlan#determineRowTransformer
) directly insideJdbcSelectExecutorStandardImpl
to reduce code duplication and align behaviours but it was way too much work and I worried to introduce regressions.See also #10177 for 6.6 branch.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license
and can be relicensed under the terms of the LGPL v2.1 license in the future at the maintainers' discretion.
For more information on licensing, please check here.
https://hibernate.atlassian.net/browse/HHH-19472