-->
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.  [ 2 posts ] 
Author Message
 Post subject: Works on one server, Unexpected Token error on other server
PostPosted: Thu Aug 26, 2004 2:12 am 
Newbie

Joined: Thu Aug 26, 2004 1:27 am
Posts: 1
We deployed our application on two WebSphere servers. On first one, we deploy EAR file. On the other one, we create projects and deploy. All the business methods accessing database are working on both servers except one which involves two tables. This particular query runs on the server where we have deployed EAR file. However it gives Unexpected Token error on the other server.

The code snippet:

final String GET_GRANTABLE_BANKS = "select c from Bank as c where c.bankUID NOT IN " + "(select a.bankID from CustomerBank as a) and " + "c.approvalCode = :approvalCode";

final String APPROVAL_CODE = "approvalCode";

Iterator itrBank = null;
try
{
if(log.isDebugEnabled())
{
log.debug("Entering Method " + METHOD_NAME);
log.debug("Input Parameter Session " + session);
}

if((null != session) && (null != approvalCode))
{
//Set the query for getting the Banks.
query = session.createQuery(GET_GRANTABLE_BANKS);
query.setEntity(APPROVAL_CODE,approvalCode);
itrBank = query.list().iterator();
}

Bank and CustomerBank are two Java classes representing two tables. Error happens on the last line itrBank = query.... The exact error message is:

The following exception was logged net.sf.hibernate.QueryException: unexpected token: as [select c from Bank as c where c.bankUID NOT IN (select a.bankID from CustomerBank as a) and c.approvalCode = :approvalCode]
at net.sf.hibernate.hql.FromParser.token(FromParser.java:94)
at net.sf.hibernate.hql.ClauseParser.token(ClauseParser.java:87)
at net.sf.hibernate.hql.PreprocessingParser.token(PreprocessingParser.java:123)
at net.sf.hibernate.hql.ParserHelper.parse(ParserHelper.java:29)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:149)
at net.sf.hibernate.hql.QueryTranslator.compile(QueryTranslator.java:138)
at net.sf.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:293)
at net.sf.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:1530)
at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1501)
at net.sf.hibernate.impl.QueryImpl.list(QueryImpl.java:39)


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 26, 2004 4:34 am 
Senior
Senior

Joined: Sun Jan 04, 2004 2:46 pm
Posts: 147
The "unexpected as" error usually means that the token just before the as wasn't recognised ( Bank or CustomerBank ) so most likely you're missing one of these classes adding to the Configuration/SessionFactory.


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

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.