-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Specifying parameters in sorting will throw an exception #40962
Comments
/cc @FroMage (panache), @loicmathieu (panache) |
Hi, Thanks for reporting. This is due to you calling a I'm not sure yet how to fix this. As a workaround, you can drop the |
I could use the HQL parser to verify which parameters to not bind from the count query, but that's going to make it more expensive for everyone. |
I could try using the new API for counting results in ORM :) |
It appears to. Good news, this makes it upstream's problem next time it happens. But it breaks projections, I have to look at that. |
Thank you for your work. I am using paging query and I do not want to open a query to count.
|
I've reported https://hibernate.atlassian.net/browse/HHH-18234 |
I understand, but in any case there will always be two queries, as the count query is executed separately, even if you don't see it. So as a workaround, to get you unstuck until we have a fix, you can create a separate query for counting. |
There's a fix for that in ORM 6.5.3. I'll make a PR to fix this when we upgrade to that version. |
This allows us to not care about which parameters are set on the count query, since `order by` parameters are ignored by ORM. Which is not the case if we write our own count query. Note that this is not yet available in HR, so we have to keep the count query logic around until that's available. Fixes #40962
This allows us to not care about which parameters are set on the count query, since `order by` parameters are ignored by ORM. Which is not the case if we write our own count query. Note that this is not yet available in HR, so we have to keep the count query logic around until that's available. Fixes quarkusio#40962
This allows us to not care about which parameters are set on the count query, since `order by` parameters are ignored by ORM. Which is not the case if we write our own count query. Fixes quarkusio#40962
Describe the bug
I'm using Panache to simplify Hibernate queries. When I use the following query, I get an exception:
find("name = :name ORDER BY ST_Distance(location, :location) DESC", Map.of("name", "Demo","location", point))
But, If I create the query directly using Hibernate, everything is fine.
Expected behavior
Set the parameters correctly
Actual behavior
UnknownParameterException: No parameter named ':location' in query with named parameters []
How to Reproduce?
In the description part gives a simple query, only need to create a table, containing the Point/geom type field;
Regardless of the database, the behavior is the same in MySQL and Postgresql
Output of
uname -a
orver
Linux 5.15.146.1-microsoft-standard-WSL2 Ubuntu
Output of
java -version
OpenJDK Runtime Environment Temurin-21.0.3+9
Quarkus version or git rev
3.11.0
Build tool (ie. output of
mvnw --version
orgradlew --version
)maven 3.9.7
Additional information
The sort is not part of the query
The text was updated successfully, but these errors were encountered: