-
Notifications
You must be signed in to change notification settings - Fork 38.4k
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
Support for Hibernate ORM 5.3 [SPR-16303] #20850
Comments
Manuel Dominguez Sarmiento commented Works needs to be done in HibernateTemplate and possibly other classes due to the following: Remove support for legacy HQL-style positional parameters The main issue is that "classic HQL" positional parameters were 0-based, while JPA/JPQL-style ordinal parameters are 1-based. Related Hibernate issues: Deprecate HQL-specific (JDBC-style) positional parameters Positional parameters report position as name This can be worked around by exclusively using named parameters (instead of either positional or ordinal), however, some HibernateTemplate methods, such as bulkUpdate() do not currently support named parameters. |
Juergen Hoeller commented With respect to As a consequence, for any specific |
Manuel Dominguez Sarmiento commented I understand. However the main issue is that deprecation will not suffice. Code that works in Spring 5.0 + Hibernate 5.2 will cease to work at all when migrating to Spring 5.1 + Hibernate 5.3. We have a very significant codebase we need to maintain (as I'm sure it happens with many other projects that have extensively made use of HibernateTemplate over the years) and it would be useful for the code to continue working without massive recoding. HibernateTemplate could detect whether the HQL query contains either positional (0-based, "?" style) or ordinal (1-based, "?1" style) parameters. Simple regex parsing can do this easily (no need for complex grammar analysis). Based on this, calls to Query.setParameter(index, value) and similar methods could add 1 to the parameter index if necessary. This should also be backward compatible with Hibernate 5.2 since ordinal ?1 style parameters have been supported for many years now, since Hibernate increasingly aligned with the standard JPA spec. I agree that HibernateTemplate should probably be deprecated going forward, but a minor release (either Spring or Hibernate) should not stop solid ORM code from working, at least not without some clear and simple upgrade path. |
Juergen Hoeller commented I'm afraid we won't be going to the extent of analyzing and/or manipulating user-specified HQL queries, not even for 'simple' regex replacements. This is potentially a deep hole in terms of follow-up bugs and a line that we never crossed before. We can keep existing Fundamentally, the outright removal of the legacy HQL positional parameter style is an aggressive step for a minor release in Hibernate itself. I suppose this means that legacy "?" placeholders won't work at all anymore? So it's not just about adapting the parameter index in Frankly, I'd rather recommend continued use of Hibernate ORM 5.2.x with Spring Framework 5.1. We'll keep supporting Hibernate ORM 5.0-5.3 at runtime anyway, so we'll allow for selective upgrading to Spring Framework 5.x while keeping your existing Hibernate version. |
Juergen Hoeller commented Our build is upgraded to Hibernate ORM 5.3 final now; everything looks fine so far. Deeper integration with its new SPIs is still pending. |
Juergen Hoeller opened SPR-16303 and commented
Hibernate ORM 5.3 is currently in preparation, finally supporting JPA 2.2. Let's pick it up for our Spring Framework 5.1 release for some deeper integration (e.g. #20852), while continuing Hibernate ORM 5.0-5.2 support at runtime (not least of it all for compatibility with WildFly 10/11 and JBoss EAP 7.0/7.1).
Issue Links:
Referenced from: commits e0ccbcb
3 votes, 9 watchers
The text was updated successfully, but these errors were encountered: