-->
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.  [ 3 posts ] 
Author Message
 Post subject: net.sf.hibernate.QueryException: in expected: select [select
PostPosted: Wed Jun 06, 2007 6:04 am 
Newbie

Joined: Wed Jun 06, 2007 5:32 am
Posts: 10
Hi Pal,

Am getting the following error while executing this code

Hibernate Version = 2.0.0

Code :
int countIdx = countString.indexOf("order");
String queryString = "select count(*) from (" +countString.substring(0,countIdx) + ") as A ";
Query countQuery = SessionCreator.currentSession(NewGDCConstants.CURRENT_SESSION).createQuery(queryString);
int recordCount = Integer.parseInt(((Object[])countQuery.list().iterator().next())[0].toString());

Error:"net.sf.hibernate.QueryException: in expected: select [select count(*) from (select distinct "- followed by aggregate query.

Can You post me the solution if any of you face this problem here before.

Thanks
Giri


Top
 Profile  
 
 Post subject:
PostPosted: Wed Jun 06, 2007 6:52 am 
Senior
Senior

Joined: Thu May 17, 2007 2:31 am
Posts: 194
Location: Sri Lanka
Hi

please tell me what is the countString is.

Amila


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 12, 2007 12:40 am 
Newbie

Joined: Wed Jun 06, 2007 5:32 am
Posts: 10
Hi,
countString is another HQL which contain order by field in "where" clause.

Thanks
Giri


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