-->
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: unExpected Token Error while running this query
PostPosted: Fri Feb 20, 2009 12:32 pm 
Newbie

Joined: Thu Nov 20, 2008 6:41 am
Posts: 3
Hi Everyone,

When run the same query form DB2 I could able to get the results but while trying it form java I get the error as Unexpected Token. Could anyone please let me know what is the issue in it.

Below is the query in java

Query qry = session.createQuery("SELECT appTrans.application_id, appTrans.trans_ts, appTrans.trans_status FROM APPLICATIONS_TRANS_DETAILS appTrans " +
"INNER JOIN (SELECT appTrans2.application_id, max(appTrans2.trans_ts) AS Column2 FROM APPLICATIONS_TRANS_DETAILS appTrans2 " +
"GROUP BY appTrans2.application_id) AS appTrans3 ON appTrans.application_id = appTrans3.application_id AND " +
"appTrans.trans_ts = appTrans3.Column2 where appTrans.application_id in(select App.APPLICATION_ID from APPLICATIONS As App " +
"where App.SKILL_ID in("+ skills.toString().substring(1,skills.toString().length()-1) + ") and App.USER_CNUM_ID='072725744' and " +
"App.LEVEL_ID in ("+levels.toString().substring(1,levels.toString().length()-1)+") order by skill_id) ORDER BY appTrans.application_id");

The generated query is

SELECT appTrans.application_id, appTrans.trans_ts, appTrans.trans_status
FROM SM.APPLICATIONS_TRANS_DETAILS appTrans INNER JOIN
(SELECT appTrans2.application_id, Max(appTrans2.trans_ts) AS Column2
FROM SM.APPLICATIONS_TRANS_DETAILS appTrans2
GROUP BY appTrans2.application_id) AS appTrans3 ON appTrans.application_id = appTrans3.application_id AND appTrans.trans_ts = appTrans3.Column2
where appTrans.application_id
in(select App.APPLICATION_ID from SM.APPLICATIONS As App where App.SKILL_ID in(121024,121025,121026,121027,121028,121029) and App.USER_CNUM_ID='072725744' and App.LEVEL_ID in (1, 2, 3)
order by skill_id)
ORDER BY appTrans.application_id

Thanks in advance
Madhava ram


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 23, 2009 1:08 pm 
Senior
Senior

Joined: Tue Aug 01, 2006 9:24 pm
Posts: 120
I would suggest posting the stack trace and any other information you might have to get a faster reply.

_________________
Please rate my replies as I need points for all of my questions also.


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.