-->
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: Can not execute HQL query (3.0rc1)
PostPosted: Thu Mar 31, 2005 4:53 pm 
Newbie

Joined: Sat Aug 14, 2004 7:28 pm
Posts: 1
I try to execute HQL query like this:

Code:
Query query = getSession().createQuery(
                "from id.co.nincec.dymension.model.Person person");


But when I do

Code:
query.list()


I always get this error message:

Code:
ClassCastException :
org.hibernate.hql.ast.HqlSqlWalker.createSelectClauseFromFromClause(HqlSqlWalker.java:443)
org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:351)
org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:119)
org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:466)
org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:194)
org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:144)
org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189)
org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414)
org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:820)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:779)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)


I dig into source code and get this line:

Code:
selectClause = ( SelectClause ) select;


select is result of:
Code:
AST select = astFactory.create( SELECT_CLAUSE, "{derived select clause}" );


and the type is SqlNode, it is imposible to cast that to SelectCluase.

What is wrong? I'm very confused.... please help me!!!

Thx,
Nanda Firdausi


Top
 Profile  
 
 Post subject:
PostPosted: Fri Apr 01, 2005 11:34 am 
Regular
Regular

Joined: Fri Sep 17, 2004 10:51 am
Posts: 61
Location: Rimini, Italy
If I remember well, I had the same problem in the past. Look in the classpath for different version of hibernate.jar and antlr.jar.

_________________
--
Marco


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.