I'm using Hibernate 2.1.1.
I'm trying to use the Query interface to obtain information.
Here's the code:
Code:
SessionFactory sessionFactory = HibernateFactory.createFactory();
session = sessionFactory.openSession();
Query query = session.createQuery("from vo.Mp as mp where mp.referencia like upper(':ref_padrao')");
query.setParameter("ref_padrao", "%" + ref_padrao + "%");
List res = query.list();
( ... )
It gives me the following error:
Code:
net.sf.hibernate.QueryException: Named parameter does not appear in Query: ref_padrao [from vo.Mp as mp where mp.referencia like ':ref_padrao']
at net.sf.hibernate.hql.QueryTranslator.getNamedParameterLocs(QueryTranslator.java:436)
at net.sf.hibernate.hql.QueryTranslator.bindNamedParameters(QueryTranslator.java:817)
( ... )
Strange error (I think) because the parameter
ref_padrao exists in the query.
Please help.
PS: why isn't the
upper() function not appearing in the exception stack!?