Skip to content
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

Hibernate Reactive with postgresql native query Cannot invoke "String.hashCode()" because "<local6>" is null #43078

Closed
agreedSkiing opened this issue Sep 6, 2024 · 4 comments
Assignees
Labels
kind/bug Something isn't working

Comments

@agreedSkiing
Copy link
Contributor

agreedSkiing commented Sep 6, 2024

Describe the bug

When trying to use a native query, the sql works in the postgresql container, i'm getting the Cannot invoke "String.hashCode()" because "<local6>" is null error.

Expected behavior

Query executed against db with no error and an empty result list.

Actual behavior

Query executing fails with using the postegresql dialect.

How to Reproduce?

Reproducer project.

https://github.com/agreedSkiing/reactive-postgresql-local6-error/tree/main

Output of uname -a or ver

Linux DI-001000095350 5.15.137.3-microsoft-standard-WSL2 #1 SMP Mon Nov 6 23:32:38 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Output of java -version

Picked up JAVA_TOOL_OPTIONS: -DargLine="-Dhttp.proxyHost=proxy.digg.se -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.digg.se -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=localhost" java 21.0.2 2024-01-16 LTS Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58) Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)

Quarkus version or git rev

3.8.5.SP1-redhat-00001

Build tool (ie. output of mvnw --version or gradlew --version)

Picked up JAVA_TOOL_OPTIONS: -DargLine="-Dhttp.proxyHost=proxy.digg.se -Dhttp.proxyPort=8080 -Dhttps.proxyHost=proxy.digg.se -Dhttps.proxyPort=8080 -Dhttp.nonProxyHosts=localhost" Apache Maven 3.9.7 (8b094c9513efc1b9ce2d952b3b9c8eaedaf8cbf0) Maven home: /home/eriase/.asdf/installs/maven/3.9.7 Java version: 21.0.2, vendor: Oracle Corporation, runtime: /home/eriase/.asdf/installs/java/oracle-21.0.2 Default locale: en_US, platform encoding: UTF-8 OS name: "linux", version: "5.15.137.3-microsoft-standard-wsl2", arch: "amd64", family: "unix"

Additional information

Needed to use mvn instead of the mvnw package since the company proxy is blocking the mvnw download.

@agreedSkiing agreedSkiing added the kind/bug Something isn't working label Sep 6, 2024
@agreedSkiing
Copy link
Contributor Author

agreedSkiing commented Sep 6, 2024

Just tested the code with plain old hibernate and the query works fine so seem to be an issue releated to hibernate reactive :(.
See branch https://github.com/agreedSkiing/reactive-postgresql-local6-error/tree/hibernate-orm-test

I also tested quarkus 3.14.2 and got the same error but with a different stacktrace see https://github.com/agreedSkiing/reactive-postgresql-local6-error/tree/hibernate-orm-test

@agreedSkiing
Copy link
Contributor Author

/cc @DavideD (hibernate-reactive), @gavinking (hibernate-reactive)

Sorry for the direct ping but quarkus bot hasn't picked up the issue for some reason

@DavideD
Copy link
Contributor

DavideD commented Nov 11, 2024

I will check

@DavideD DavideD self-assigned this Nov 11, 2024
@DavideD
Copy link
Contributor

DavideD commented Nov 11, 2024

The problem is caused by a bug in Hibernate Reactive that's been solved as part of issue hibernate/hibernate-reactive#1984. Basically, Hibernate Reactive returns null when it should return the column type name of the result. It's fixed by commit 0680041f.

So, the solution is to use a version of Quarkus that contains Hibernate Reactive 2.4.2. I cannot think of any workaround at the moment.
I've updated your project to use Quarkus 3.16.2 and everything seems to work: DavideD/reactive-postgresql-local6-error@6c276ad

There is also an extra commit that refactors the code a little, it's mostly a personal preference and it's not mandatory for the project: DavideD/reactive-postgresql-local6-error@a92adfd

I'm closing the issue, but feel free to continue the discussion here if you have more questions.

@DavideD DavideD closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants