NativeQueryTupleTransformer doesn't handle null values in returned ResultSet

Description

If the native query returns tuple containing null values, then NativeQueryTupleTransformer throws IllegalArgumentException with the message "Unknown alias [aliasName]", where aliasName is the name of the column having null value. For instance, "aliasToValue" contains
entries
<id, 1>
<value, null>
For this case "Unknown alias [value]" will be shown.

Bug is caused by:

which returns null for the key which is present in the map, but the value itself is null.

Suggested fix:
We have to check if the key is present in "aliasToValue" map via "containsKey" method.

Environment

None

Activity

Show:
Vlad Mihalcea
October 30, 2017, 1:07 PM

Applied PR upstream.

Maksym Symonov
October 29, 2017, 9:31 AM

One another existing test was modified to verify that the impacted case behaves as desired

Maksym Symonov
October 28, 2017, 9:01 AM

Pull request containing the fix and couple of simple unit tests for the impacted class was raised.
Do you think we need more complex ones? Integration test cases which bring up the whole context?
Honestly the issue itself is so small and local, that i see no point in adding anything else, but if you think it is mandatory, then i will try extending the coverage.
Thanks in advance for pulling in the changes

Gail Badner
October 27, 2017, 7:40 PM

Please attach a test case that reproduces your test case. Templates are at https://github.com/hibernate/hibernate-test-case-templates.

Or, since you have a proposed fix, it would be great if you could create a pull request with a test case and your fix.

Fixed

Assignee

Unassigned

Reporter

Maksym Symonov

Fix versions