quarkus
quarkus copied to clipboard
Panache + Hibernate Reactive - Can not use project() alongside list()
Describe the bug
When trying to fetch all rows from a table using projection, the response is never bubbled to the caller. If project() is removed, or if project(xxx.class).singleResult() is used, the response is returned correctly.
Note: I´m migrating from an existing codebase (Quarkus 1.9.2) that heavily relies on vertx and verticles. The project handled the queries without panache & hibernate, so we wanna check if using an orm is worth the effort in this case.
Expected behavior
No response
Actual behavior
No response
How to Reproduce?
Reproducer: https://gitlab.com/gus.gramajo/panache-reactive-reproducer
Steps:
1 - Run ./mvnw quarkus:dev
2 - Import Postman Collection (Users - Repro.postman_collection.json at the root of the project )
3 - Send a "Save User" request. This will work fine.
4 - Send a "Get Users" request. You will see this in the console:
2024-01-31 18:12:35,784 [US] [vert.x-eventloop-thread-2] DEBUG - org.hibernate.orm.results.loading - Calling top-level assembler (0 / 1) : org.hibernate.sql.results.graph.instantiation.internal.DynamicInstantiationAssemblerConstructorImpl@24f817
2024-01-31 18:12:35,784 [US] [vert.x-eventloop-thread-2] DEBUG - org.hibernate.orm.results - Extracted JDBC value [0] - [123789]
2024-01-31 18:12:35,785 [US] [vert.x-eventloop-thread-2] DEBUG - org.hibernate.orm.results - Extracted JDBC value [1] - [bob]
2024-01-31 18:12:35,785 [US] [vert.x-eventloop-thread-2] DEBUG - org.hibernate.resource.jdbc.internal.LogicalConnectionManagedImpl - Initiating JDBC connection release from afterTransaction
Indicating that the query worked just fine. Nonetheless, the request will hang, and eventually you will get this:
ERROR - com.foo.bar.users.API - Cause: (TIMEOUT,-1) Timed out after waiting 30000(ms) for a reply. address: __vertx.reply.2, repliedAddress: getUsers
This method uses project(xxx.class).list().
5 - Send a "Get User" request. You will get:
{
"user": {
"id": "123789",
"name": "bob"
},
"success": true
}
This method uses project(xxx.class).singleResult().
6 - Send a "Get Users Without Projection". You will get:
{
"users": [
[
"123789",
"bob"
]
],
"success": true
}
This method uses list()
Output of uname -a or ver
Darwin MacBook-Pro.local 23.3.0 Darwin Kernel Version 23.3.0: Wed Dec 20 21:31:00 PST 2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6020 arm64
Output of java -version
openjdk version "21.0.1" 2023-10-17 OpenJDK Runtime Environment (build 21.0.1+12-29) OpenJDK 64-Bit Server VM (build 21.0.1+12-29, mixed mode, sharing)
Quarkus version or git rev
3.5.3
Build tool (ie. output of mvnw --version or gradlew --version)
Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546) Maven home: /Users/xxx/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5 Java version: 21.0.1, vendor: Oracle Corporation, runtime: /Users/xxx/Library/Java/JavaVirtualMachines/openjdk-21.0.1/Contents/Home Default locale: es_AR, platform encoding: UTF-8 OS name: "mac os x", version: "14.3", arch: "aarch64", family: "mac"
Additional information
Docker Desktop 4.26.1 (131620)
/cc @DavideD (hibernate-reactive), @FroMage (panache), @gavinking (hibernate-reactive), @loicmathieu (panache)
2 - Import Postman Collection (Users - Repro.postman_collection.json at the root of the project )
Can you clarify how?
@FroMage the env file was missing; i have pushed it and added a short description on how the files should be imported using Postman. Please let me know if this is enough, thanks
I tested this again and starting from 3.6.0 (up to 3.8.2) this no longer happens. Thanks!
Cool :)