Hibernate ORM 5.3: Removed support for positional parameters

Hello all,

I’m working to upgrade the Hibernate version of my application stack to version 5.3. In this new version, support for positional query parameters (’?’) has been removed[1].

This is big problem as my application executes a lot of queries which were implemented making us of this kind of parameters. As the API of the Query class did not change together with this change, I’m able to compile without erros but all these queries are failing at runtime.

What do you recommend? Should I change all the queries one by one?. I think that it could be very helpful to have a setting that would enable backwards compatibility for this kind of queries. What do you think?

Thanks in advance.

[1] https://hibernate.atlassian.net/browse/HHH-12101

That’s a legacy behavior that’s been overridden by JPA. So, if you didn’t remove it now, we would remove it in a future release anyway, therefore prolonging the same outcome.

There are many other legacy behaviors that change because of the JPA spec, and that’s not necessarily a bad thing. The framework evolves with time.

Nevertheless, it’s much better to use named parameters than positional ones because, this feature, is much more resilient to such changes, is supported by JPA, and allows you to reuse the same parameter multiple times.