-->
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.  [ 5 posts ] 
Author Message
 Post subject: Unexpected Token Problem
PostPosted: Thu May 03, 2007 1:41 am 
Newbie

Joined: Thu May 03, 2007 1:37 am
Posts: 3
Hi,

Please see the following query. When I execute this from Code it gives me

SEVERE: *** ERROR: line 1:491: unexpected token: (
May 3, 2007 11:06:59 AM org.hibernate.hql.ast.ErrorCounter reportError
SEVERE: *** ERROR: line 1:562: unexpected token: (
May 3, 2007 11:06:59 AM org.hibernate.hql.ast.ErrorCounter reportError
SEVERE: *** ERROR: line 1:588: unexpected token: max
May 3, 2007 11:06:59 AM org.hibernate.hql.ast.ErrorCounter reportError
SEVERE: *** ERROR: line 1:609: unexpected token: AS


Although this query works perfectly in DB2. Please Note Brackets and syntax is perfectly correct as it works in database.

Its urgent kindly look into the matter.

-------------------------- Query -----------------------------------------
+ "SELECT DISTINCT t1.tfzRequestId"
+ " FROM"
+ " FzRequestAllowanceViewDE AS t1,"
+ " ("
+ " SELECT A.tfzDecisionId"
+ " FROM FzDecisionDE A,"
+ " ("
+ " SELECT B.tfzRequestId , max (B.decisionDate) AS MAXDECISIONDATE FROM FzDecisionDE B"
+ " WHERE B.bisFinalized = 'T'"
+ " AND B.decisionDate <= '2008-12-31 00:00:00.000000'"
+ " GROUP BY B.tfzRequestId" + " ) AS x"
+ " WHERE A.tfzRequestId = x.tfzRequestId"
//+ " AND A.decisionDate = X.MAXDECISIONDATE"
+ " AND A.bisFinalized = 'T'"
+ " GROUP BY A.tfzRequestId, A.tfzDecisionId" + " ) AS t2");

---------------------------------------------------------------------------

Thanks

Dhiraj


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 1:54 am 
Expert
Expert

Joined: Tue Jan 30, 2007 12:45 am
Posts: 283
Location: India
Hi


try to see whole query in single line .That would help you

_________________
Dharmendra Pandey


Top
 Profile  
 
 Post subject: Unexpected Token Problem
PostPosted: Thu May 03, 2007 2:56 am 
Newbie

Joined: Thu May 03, 2007 1:37 am
Posts: 3
Hi
I have checked everything as I wrote this query is working in db2 perfectly.

Its urgent please help.

thanks

Dhiraj


Top
 Profile  
 
 Post subject:
PostPosted: Thu May 03, 2007 3:07 am 
Regular
Regular

Joined: Mon Mar 26, 2007 12:38 am
Posts: 119
Hi,
have you used session.createSQLQuery() ? ( not session.createQuery())

-------------------------------------------------
Rate the reply if you find it helpful


Top
 Profile  
 
 Post subject: Unexpected Token Problem
PostPosted: Thu May 03, 2007 5:19 am 
Newbie

Joined: Thu May 03, 2007 1:37 am
Posts: 3
Hi,

To be specific following query is not working. I just want to know how can i use a inner query which is aliased with AS.


SELECT A.tfzRequestId, A.tfzDecisionId FROM FzDecisionDE A,"
+ " (SELECT B.tfzRequestId FROM FzDecisionDE B) AS X"
+ " where A.tfzRequestId = X.tfzRequestId"


We add this query in a String Buffer then we pass this buffer as String in the following method.

HibernateTemplate template = getHibernateTemplate();
list = template.find(pQueryString, pValues);


Thanks

Dhiraj Srivastava


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 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.