You may have encountered following error if you are migrating hibernate to version 5.x from an older version,

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

This happens due to changes in hibernate HQL parameters of latest versions. Here is a quick fix to overcome this issue

Simply replace ‘?’ with ‘?0’ in your HQL query. For example consider following query,

from Customer where id= ?

You may fix this query as below,

from Customer where id= ?0

About the Author

Sadupa Wijeratne

Sadupa Wijeratne is the founder of My Cute Blog. Currently working as a software engineer. Interested about latest technologies and love to learn by experience.

View All Articles