-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Exception--------org.hibernate.QueryException: in expected:
PostPosted: Thu Jun 25, 2009 1:16 am 
Newbie

Joined: Thu Jun 25, 2009 1:10 am
Posts: 1
Hi,

I am using IN clause in HQL query and thereby getting this exception :

org.hibernate.QueryException: in expected: dr [ from DR_EXPR_VAR_MAPPING dr where dr.compId.doc_set_id = ? and dr.compId.variable in(:actualVariables) ]
at org.hibernate.hql.classic.FromParser.token(FromParser.java:106)
at org.hibernate.hql.classic.ClauseParser.token(ClauseParser.java:86)
at org.hibernate.hql.classic.PreprocessingParser.token(PreprocessingParser.java:108)
at org.hibernate.hql.classic.ParserHelper.parse(ParserHelper.java:28)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:192)
at org.hibernate.hql.classic.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:168)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:77)
at org.hibernate.engine.query.HQLQueryPlan.<init>(HQLQueryPlan.java:56)
at org.hibernate.engine.query.QueryPlanCache.getHQLQueryPlan(QueryPlanCache.java:71)
at org.hibernate.impl.AbstractSessionImpl.getHQLQueryPlan(AbstractSessionImpl.java:133)
at org.hibernate.impl.AbstractSessionImpl.createQuery(AbstractSessionImpl.java:112)
at org.hibernate.impl.SessionImpl.createQuery(SessionImpl.java:1586)
at src.TestExpVarMap.main(TestExpVarMap.java:39)



Please check the code and let me know what is the problem...Thanks in advance.


Code

package src;

import java.util.*;
import java.io.*;
import org.hibernate.*;

public class TestExpVarMap
{
public static void main(String args[])
{

Map<String,String> globalVariableMap=new HashMap<String,String>();
String variable =null;
Session session=null;
session = HibernateUtil.currentSession();
List actualVariablesList=null;
List queryList=null;

try
{

globalVariableMap.put("LOAN.AMOUNT", "/TOPUP/Loan/Amount");
globalVariableMap.put("APPLICANT.STATE", "/TOPUP/APPLICANT/STATE");
globalVariableMap.put("APPLICANT.COUNTRY", "/TOPUP/APPLICANT/COUNTRY");
globalVariableMap.put("SECURITY.AMOUNT", "/TOPUP/SECURITY/Amount");
globalVariableMap.put("BORROWER.NAME", "/TOPUP/BORROWER/NAME");
globalVariableMap.put("BRANCH.NAME", "/TOPUP/BRANCH/NAME");

Iterator iterator = (globalVariableMap.keySet()).iterator();
actualVariablesList=new ArrayList();
int i=0;
while(iterator.hasNext()) {
variable = iterator.next().toString();
actualVariablesList.add(variable);
System.out.println("the values are "+actualVariablesList.get(i));
i++;
}

Query query =session.createQuery( " from DR_EXPR_VAR_MAPPING dr where dr.compId.doc_set_id = ? " +
" and dr.compId.variable in(:actualVariables) ");

query.setParameterList("actualVariables", actualVariablesList);
//query.setLong(0, 4);
query.executeUpdate();
queryList = query.list();

session.close();

/* while (rs.next())
{
variableMapping = new VariableMapping();
variableMapping.setValue(rs.getString("VALUE"));
variableMapping.setValueType(rs.getString("VALUETYPE"));
variable = rs.getString("VARIABLE");
docSetExprVarMapping.put(variable,variableMapping.getValue());

}*/
}
catch(HibernateException e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}

Atul Pandey


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.