java.lang.ClassCastException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • I've found an error using named queries with hibernate 3 beta 4 (CVS today checkout). I've tracked down the problem to the class org.hibernate.hql.ast.SyntheticAndFactory(line 44): fragment = ( SqlFragment ) ASTUtil.create( astFactory, SQL_TOKEN, whereFragment ); but the method returns AST object (org.hibernate.hql.ast.ASTUtil:34): public static AST create(ASTFactory astFactory, int type, String text) { AST node = astFactory.create( type, text ); return node; } The error occurs during initialization, when hibernate checks for named queries correctness. This occurs with every query. Changing the parser from AST to classic solves the problem. Here's full stack trace: 15:25:12,833 INFO SessionFactoryImpl:365 - Checking 4 named queries 15:25:14,351 ERROR PersistenceManagerFactory:38 - error configuring java.lang.ClassCastException at org.hibernate.hql.ast.SyntheticAndFactory.addWhereFragment(SyntheticAndFactory.java:44) at org.hibernate.hql.ast.JoinProcessor.addJoinNodes(JoinProcessor.java:98) at org.hibernate.hql.ast.JoinProcessor.processJoins(JoinProcessor.java:70) at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:354) at org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:112) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:296) at org.hibernate.hql.antlr.HqlSqlBaseWalker.select(HqlSqlBaseWalker.java:132) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:202) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:413) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:374) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:277) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1033) ...
    via by Marco Papini,
  • I've found an error using named queries with hibernate 3 beta 4 (CVS today checkout). I've tracked down the problem to the class org.hibernate.hql.ast.SyntheticAndFactory(line 44): fragment = ( SqlFragment ) ASTUtil.create( astFactory, SQL_TOKEN, whereFragment ); but the method returns AST object (org.hibernate.hql.ast.ASTUtil:34): public static AST create(ASTFactory astFactory, int type, String text) { AST node = astFactory.create( type, text ); return node; } The error occurs during initialization, when hibernate checks for named queries correctness. This occurs with every query. Changing the parser from AST to classic solves the problem. Here's full stack trace: 15:25:12,833 INFO SessionFactoryImpl:365 - Checking 4 named queries 15:25:14,351 ERROR PersistenceManagerFactory:38 - error configuring java.lang.ClassCastException at org.hibernate.hql.ast.SyntheticAndFactory.addWhereFragment(SyntheticAndFactory.java:44) at org.hibernate.hql.ast.JoinProcessor.addJoinNodes(JoinProcessor.java:98) at org.hibernate.hql.ast.JoinProcessor.processJoins(JoinProcessor.java:70) at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:354) at org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:112) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:296) at org.hibernate.hql.antlr.HqlSqlBaseWalker.select(HqlSqlBaseWalker.java:132) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:202) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:413) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:374) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:277) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1033) ...
    via by Marco Papini,
    • java.lang.ClassCastException at org.hibernate.hql.ast.SyntheticAndFactory.addWhereFragment(SyntheticAndFactory.java:44) at org.hibernate.hql.ast.JoinProcessor.addJoinNodes(JoinProcessor.java:98) at org.hibernate.hql.ast.JoinProcessor.processJoins(JoinProcessor.java:70) at org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:354) at org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:112) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:296) at org.hibernate.hql.antlr.HqlSqlBaseWalker.select(HqlSqlBaseWalker.java:132) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:202) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:413) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:374) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:277) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1033)
    No Bugmate found.