-
Notifications
You must be signed in to change notification settings - Fork 868
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
Use of Hibernate 5.3 and HibernateQuery results in "Could not locate named parameter" #2326
Comments
Thanks for your research. |
Oh, so the recent Hibernate version did in fact not reestablish backwards compatibility? |
This issue is unrelated to #1917. QueryDSL relied on Hibernate's behaviour that a positional parameter was basically a named parameter. This is no longer the case since 5.3.0.Beta1 (see the Hibernate ticket that @jpimag mentioned above). From now on, QueryDSL needs to keep its positional parameters separated from the named parameters. Even though we have noticed this issue with Hibernate 5.3, a fix would also work with older versions. So in theory, there is no need to wait for QueryDSL 5.x and a patch could already be applied to QueryDSL's 4.x branches (obviously depends on whether the effort is worth it). |
Someone else discovered the same issue and worked around it: That is not the proper fix as |
… for treating numbered parameters as named parameters. see querydsl#2326 and https://hibernate.atlassian.net/browse/HHH-12116. Proper solution would be to modify SerializerBase to separate numbered and named parameters, as described here querydsl#2326 (comment), but this hacky solution is working for me
Hi. |
@PavlikPolivka: I don't think that anybody started creating a proper fix for it. Feel free to work on it. |
Could you test if the recent Hibernate versions? |
I am experiencing this with latest hibernate and latest query dsl.
Hibernate fixed all their binary compatibilies (as far as I know) this is
caused by hibernate fixing a way parameters are interpreted (correctly
fixing) and query dsl is using the wrong version.
…On Sat, 11 Aug 2018 at 11:42, Ruben Dijkstra ***@***.***> wrote:
Could you test if the recent Hibernate versions?
I don't know what they've restored backwards compatibility with, but they
did something
<#1917 (comment)>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2326 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHJtrsYH70n52yZXV88Eks1X-iiPR452ks5uPqcEgaJpZM4U0a5z>
.
|
So. If I change this to number based parametrs it works ok with Hibernte 5.3. This means that if this fix is accepted there is incopatibility for hibernate 4.x. |
What's going on with this? Is there going to be a new querydsl release with 5.3.x compatibility? |
Yes, of course it is. I'm just currently busy with other things that impact my future, as I've stated in multiple other threads, and the google group, when I have more time on my hands to work on my hobby I will. |
@Shredder121 is there anything we can do to help sorting this out? |
Is anyone working on, or planning to work on, patching this? |
Fixed in #2354. It will be featured in the next official release, which will also remove support for Hibernate 4. For now, you can try it out in 4.2.3-SNAPSHOT. I'd appreciate your feedback. Thanks! |
The use of querydsl-jpa's HibernateQuery with Hibernate 5.3 will thrown an exception when you use parameters:
I am not the only person experiencing this error, as @jpimag experienced the same issue:
#2283 (comment)
To reproduce this issue, I modified the querydsl-example-jpa-guice example contained within the QueryDSL repository. You can find the patch here:
https://gist.github.com/andygoossens/5eed865ccfe84857f7e99ddb2dfb5790
Then just run test class
com.querydsl.example.jpa.repository.TweetRepositoryTest
and check whether it fails.You can easily compare the different behaviour between Hibernate versions by altering the
<hibernate.version>
parameter in the POM file (part of the "hibernate5" profile). e.g. Hibernate version 5.2.17.Final works fine, but version 5.3.1.Final fails. Don't forget to activate the necessary Maven profile(s) of course! :-)It looks like there is a mixup between named query parameters and positional query parameters.
getConstantToLabel()
could contain a constant with index "1" (as a String and meant to be used as?1
) but QueryDSL is callingQuery<R> setParameter(String name, Object val);
meant for named parameters (like:example
). Hibernate does not find the named parameter "1" and fails.The text was updated successfully, but these errors were encountered: