I have modified my deprecated positional parameter HQL queries to the following JPA-style positional parameter:
Query query = sessionFactory.getCurrentSession().createQuery("from Customer where name = ?0");
query.setParameter(0, "Smith");
The second line now leads to an Exception:
Debugging the parsing of the query in HqlSqlBaseWalker, the code executes line https://github.com/hibernate/hibernate-orm/blob/4.2.7.SP1/hibernate-core/src/main/antlr/hql-sql.g#L754 which is described by: An ejb3-style "positional parameter", which we handle internally as a named-param So here a named parameter is created. But above Exception in ParameterMetadata is due to searching for an ordinal/positional parameter which is obviously not there, as it was saved a a named parameter before. In the debugger I can see my parameter in the namedDescriptorMap, being of type NamedParameterDescriptor.
|