Hello I have the following query
String HQL =
SELECT IO.IO_ID AS IO_ID, IO.IO_TYPE_ID AS IO_TYPE_ID, IO_TYPE.IO_TYPE_NAME AS IO_TYPE_NAME,
IO.IO_NAME AS IO_NAME, IO.GIST AS GIST, GEO.LATITUDE AS LATITUDE, GEO.LONGITUDE AS LONGITUDE
from IO_DATA IO, IO_GEOMETRY GEO, IO_TYPE_TABLE IO_TYPE
where IO.IO_ID=GEO.IO_ID
and IO.IO_TYPE_ID=IO_TYPE.IO_TYPE_ID
and IO.STATUS_ID=1
and IO.IO_TYPE_ID in (5,4,3)
AND IO.BEGIN_DATE>=trunc(to_date(:startDate,'MM/DD/YYYY'))
AND IO.END_DATE<trunc(to_date(:endDate,'MM/DD/YYYY'))+1
I am passing the parameters startDate and endDate in HashMap and setting those as startDate='06/15/2007' and endDate='07/10/2007'. But when executing the following pice of code it is throwing the following exception
Session session = HibernateUtil.getSession();
Query query = session.createQuery(HQL);
ArrayList resultList = query.list();
10 Jul 10:45:58 ERROR com.ijet.data.handler.DataHandler: Exception
net.sf.hibernate.QueryException: in expected: IO [SELECT IO.IO_ID AS IO_ID, IO.IO_TYPE_ID AS IO_TYPE_ID, IO_TYPE.IO_TYPE
_NAME AS IO_TYPE_NAME, IO.IO_NAME AS IO_NAME, IO.GIST AS GIST, GEO.LATITUDE AS LATITUDE, GEO.LONGITUDE AS LONGITUDE from
IO_DATA IO, IO_GEOMETRY GEO, IO_TYPE_TABLE IO_TYPE where IO.IO_ID=GEO.IO_ID and IO.IO_TYPE_ID=IO_TYPE.IO_TYPE_ID and IO
.STATUS_ID=1 and IO.IO_TYPE_ID in (5,4,3) AND IO.BEGIN_DATE>=trunc(to_date(:startDate,'MM/DD/YYYY')) AND IO.END_DATE<tru
nc(to_date(:endDate,'MM/DD/YYYY'))+1]
at net.sf.hibernate.hql.FromParser.token(Ljava.lang.String;Lnet.sf.hibernate.hql.QueryTranslator;)V(FromParser.j
ava:102)
at net.sf.hibernate.hql.ClauseParser.token(Ljava.lang.String;Lnet.sf.hibernate.hql.QueryTranslator;)V(ClausePars
er.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(Ljava.lang.String;Lnet.sf.hibernate.hql.QueryTranslator;)V(Pre
processingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(Lnet.sf.hibernate.hql.Parser;Ljava.lang.String;Ljava.lang.String;Lnet
.sf.hibernate.hql.QueryTranslator;)V(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile()V(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(Lnet.sf.hibernate.engine.SessionFactoryImplementor;Ljava.util.Ma
p;Z)V(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(Ljava.lang.String;Z)[Lnet.sf.hibernate.hql.QueryTranslator;
(SessionFactoryImpl.java:293)
at net.sf.hibernate.impl.SessionImpl.getQueries(Ljava.lang.String;Z)[Lnet.sf.hibernate.hql.QueryTranslator;(Sess
ionImpl.java:1554)
at net.sf.hibernate.impl.SessionImpl.find(Ljava.lang.String;Lnet.sf.hibernate.engine.QueryParameters;)Ljava.util
.List;(SessionImpl.java:1525)
I am getting the above exception. If i am executing the query explicitly it is giving proper results. Plz help on this. Thanks in advance..........
Regards,
Hari Kumar
|