Problem : I am getting one exception while trying to execute a query using hibernate
org.hibernate.QueryException: Not all named parameters have been set: [] [from FunctionPointDO f where f.workPackage='work package : id1' and f.workPackageIdentifier='work : ref1' and f.startDate='03-Jan-2010' and f.goLiveDate='04-Feb-2010' and f.id!='1000100']
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:114)
at org.hibernate.impl.AbstractQueryImpl.verifyParameters(AbstractQueryImpl.java:101)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:70)
at com.bt.fp.server.Utils.Utils.listAndCast(Unknown Source)
at com.bt.fp.server.database.dao.FunctionPointDAO.isDuplicate(Unknown Source)
at com.bt.fp.server.AddUpdateFPData.doPost(Unknown Source)
It seems that this error is due to the “:” which is used as a value in f.workPackage='work package : id1' and f.workPackageIdentifier='work : ref1'. I checked on net and hibernate considers anything starting with colon (: ) as a variable, and here id1 and ref1 are treated as variable whose value is not set anywhere. This error comes only when colon has spaces around it.
How can I escape colon. As these values are entered by users, I don’t have any control over whatever input they provide.