Suppose you try this...
Code:
Query q = session.createQuery("select x from Person x where x.name = :name");
q.setParameter(0,"thename");
List list = q.list();
You will get an IndexOutOfBoundsException which states:
"Remember that ordinal parameters are 1-based!"
However, the Hibernate documentation states (which is correct):
"Contrary to JDBC, Hibernate numbers parameters from zero."
Should I file a bug to fix the error message? I know why the exception happens, because there really are no ordinal parameters in the query string (changing ":name" to "?" fixes it), but the error message is misleading. It makes you think you need to pass in 1 instead of 0 to the setParameter() method. That, of course, does nothing to fix the problem.
Hibernate version: 3.2.2.ga