| I'm executing this query:
 Query query = sess.createQuery( "
 from Car as Car
 where Car.id=?");
 query.setParam(0,carPK);
 
 where id is Hibernate pk identifier, and value of ? is Object that represents composite primary key.
 
 The following exception occures:
 
 
 org.hibernate.QueryException: Expected positional parameter count: 1, actual parameters: [dataaccess.crud.hibernate.CarPk@5b35] [from Car as Car
 where Car.id=?
 ]
 at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:319)
 at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:275)
 at org.hibernate.impl.QueryImpl.list(QueryImpl.java:75)
 at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:811)
 at
 (...)
 
 if I change the query to
 
 
 Query query = sess.createQuery( "
 from Car as Car
 where Car.id=:param1");
 query.setParam("param1",carPK);
 
 and use the same object as value of param1, everything is ok
 
 
 |