java.lang.ClassCastException

Hibernate JIRA | Marco Papini | 1 decade ago
  1. 0

    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) ...

    Hibernate JIRA | 1 decade ago | Marco Papini
    java.lang.ClassCastException
  2. 0

    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) ...

    Hibernate JIRA | 1 decade ago | Marco Papini
    java.lang.ClassCastException
  3. 0

    JPA Exceptions for certain case constructs

    GitHub | 4 years ago | timowest
    java.lang.ClassCastException: org.hibernate.hql.ast.tree.ParameterNode cannot be cast to org.hibernate.hql.ast.tree.SelectExpression
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    ClassCastException : PortableRemoteObject.

    Oracle Community | 1 decade ago | 403765
    java.lang.ClassCastException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.ClassCastException

      No message provided

      at org.hibernate.hql.ast.SyntheticAndFactory.addWhereFragment()
    2. Hibernate HQL/JP-QL Parser
      HqlSqlWalker.processQuery
      1. org.hibernate.hql.ast.SyntheticAndFactory.addWhereFragment(SyntheticAndFactory.java:44)
      2. org.hibernate.hql.ast.JoinProcessor.addJoinNodes(JoinProcessor.java:98)
      3. org.hibernate.hql.ast.JoinProcessor.processJoins(JoinProcessor.java:70)
      4. org.hibernate.hql.ast.HqlSqlWalker.processQuery(HqlSqlWalker.java:354)
      4 frames
    3. Hibernate
      HqlSqlBaseWalker.select
      1. org.hibernate.hql.antlr.HqlSqlBaseWalker.afterQuery(HqlSqlBaseWalker.java:112)
      2. org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:296)
      3. org.hibernate.hql.antlr.HqlSqlBaseWalker.select(HqlSqlBaseWalker.java:132)
      3 frames
    4. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:202)
      2. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:158)
      3. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:111)
      3 frames
    5. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:413)
      2. org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:374)
      3. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:277)
      3 frames
    6. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1033)
      1 frame