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