0

'm currently working on a project that utilizes Hibernate as the ORM tool, and we have recently updated to the latest version of Hibernate (post-5.2). In our codebase, we have been using native SQL queries with the createSQLQuery method, which allowed us to use legacy-style parameters like ?. However, upon the update, we encountered the following error message:

"org.hibernate.QueryException: Legacy-style query parameters (?) are no longer supported; use JPA-style ordinal parameters (e.g., ?1)"

I understand that Hibernate deprecated createSQLQuery and recommends using JPA-style ordinal parameters. While I'm aware of this recommended approach, for the time being, I'm interested in finding alternative solutions or workarounds to keep our native queries intact as they are.

Has anyone faced a similar issue with the latest Hibernate version, and is there a way to continue using native queries with legacy-style parameters? If so, what would be the best approach to handle this situation and avoid the deprecated method?

Any insights, code examples, or suggestions would be greatly appreciated. Thank you!

  • Please provide enough code so others can better understand or reproduce the problem. – Lore Jul 29 '23 at 13:41
  • Ive like this "select * from emp_table where emp_id= ?" i dont want to update this prams at more than 2k instances , can u please suggest if there is any way to do so. – siddharth jidage Jul 31 '23 at 08:57

0 Answers0