-->
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: Incorrect syntax near the keyword 'as'. Please help me
PostPosted: Wed May 21, 2008 12:42 pm 
Newbie

Joined: Fri Apr 18, 2008 1:07 am
Posts: 14
Location: Pakistan
Hi All!

I am facing the following exception when I execute this query.

Code:
String propertyName= "businessLoginId";
String queryString = "from Amount as model where model."
               + propertyName + "= ?";
         Query queryObject = session.createQuery(queryString);
         queryObject.setParameter(0, value);
         return queryObject.list();



com.microsoft.sqlserver.jdbc.SQLServerException: Incorrect syntax near the keyword 'as'.
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(Unknown Source)
org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:120)
org.hibernate.loader.Loader.getResultSet(Loader.java:1272)
org.hibernate.loader.Loader.doQuery(Loader.java:391)
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:218)
org.hibernate.loader.Loader.doList(Loader.java:1593)
org.hibernate.loader.Loader.list(Loader.java:1577)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
eexits.db.AmountManager.findByProperty(AmountManager.java:25)
eexits.db.AmountManager.findByBusinessLoginId(AmountManager.java:32)
eexits.action.SpecialAction.execute(SpecialAction.java:52)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:431)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:236)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:414)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


Please help me. I would be very grateful. Mapping is ok and so is the configuration.

_________________
Muhammad Kashif Nazar
Software Engineer


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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.