Hi everybody!
Can someone explain me why the first query doesn't work while the second works? :
Query that doesn't work :
String hqlQuery = " from Dnasalary "+
" where campagne = :campagne "+
" and numeroadherent = :numeroadherent "+
" and TRIM(UPPER(nomsalariedna)) like TRIM(UPPER(:nomsalariedna)) "+
" order by nomsalariedna ";
dnasalarysList = session.createQuery(hqlQuery).setInteger("campagne",campagne).setInteger("numeroadherent",numeroadherent).setString("nomsalariedna",nomsalariedna).list();
I got the error : DB2 SQL0418 Use of parameter marker is not valid. SQL0419, SQLCODE -419 SQLSTATE 42911
Query that works :
String hqlQuery = " from Dnasalary "+
" where campagne = :campagne "+
" and numeroadherent = :numeroadherent "+
" and TRIM(UPPER(nomsalariedna)) like TRIM(UPPER('"+nomsalariedna+"%')) "+
" order by nomsalariedna ";
dnasalarysList = session.createQuery(hqlQuery).setInteger("campagne",campagne).setInteger("numeroadherent",numeroadherent).list();
As you can see, the only difference is that didn't use a nammed parameter...if someone can explain me....I won't die stupid...;o)
Thanks
|