Hello All,
I am using Hibernate 3.0,and i have following query..
My Criteria query is
.
.
Code:
if (city != null && city.trim().length() > 0){
criteria.add(Restrictions.ilike("city", city.trim(), MatchMode.ANYWHERE));
}
criteria.list();
This is throwing error for when city is 'ahmedabad' i am passing city with single quotes at start and at the end as well.
Criteria Query forms like :-
CriteriaImpl(com.map.cms.bus.data.POI:this[][city ilike %'ahmedabad'%])It shows following error
Code:
ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: syntax error at or near "ahmedabad"
Position: 74
ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/mapcms_ui].[mapcms] - Servlet.service() for servlet mapcms threw exception
org.hibernate.exception.SQLGrammarException: could not execute query
at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:90)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
at org.hibernate.loader.Loader.doList(Loader.java:2231)
at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2125)
at org.hibernate.loader.Loader.list(Loader.java:2120)
at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:312)
at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1722)
at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:165)
at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:175)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835
Thanks in advance...