I have a queryString along the lines of:
session.createSQLQuery("SELECT C.FIRSTNAME AS firstName, C.LASTNAME as lastName FROM ADDRESSBOOK_CONTACT AS C WHERE C.ADDRESSBOOK_ID = :addressbookId AND firstName = ?");
When setting my positional parameter, the query is run as normal but there is no result:
query.setParameter(0, "firstname1010");
query.setParameter("addressbookId", addressbook.getId());
Which is wrong. If I change my positional to named:
query.setParameter(firstname, "firstname1010");
Then my query returns the correct results.
Without going into a convoluted explanation as to why I am doing this, I would like to know if mixing the two types should be supported or not? I am using hibernate 3.6.3.Final
From the Class level docs on
org.hibernate.Query:So the behaviour you’re seeing is completely expected.