org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: . [ from AnyObject obj order by anypackage.anyfunction(obj.id) ]

Hibernate JIRA | Roland Scheel | 1 decade ago
  1. 0

    CREATE OR REPLACE PACKAGE anypackage IS function anyfunction return number; END; / CREATE OR REPLACE PACKAGE body anypackage IS function anyfunction return number is BEGIN return 0; END; END; <query name="anyquery"><![CDATA[ from AnyObject obj order by anypackage.anyfunction(obj.id) ]]> </query> Exception at Runtime: 11:17:46,574 ERROR SessionFactoryImpl:298 - Error in named query: anyquery org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: . [ from AnyObject obj order by anypackage.anyfunction(obj.id) ] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:425) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:386) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:289) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055) at de.tmobile.cs.db.AbstractCSDatabase.<init>(AbstractCSDatabase.java:94) at de.tmobile.cs.db.CSDatabase.<init>(CSDatabase.java:13) at de.tmobile.cs.db.CSDatabase.getInstance(CSDatabase.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at de.tmobile.cs.dbrt.SessionFactoryProvider.<clinit>(SessionFactoryProvider.java:53) at de.tmobile.cs.db.AutomaticQueryTest.testQueries(AutomaticQueryTest.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.textui.TestRunner.doRun(TestRunner.java:116) at junit.textui.TestRunner.doRun(TestRunner.java:109) at junit.textui.TestRunner.run(TestRunner.java:72) at junit.textui.TestRunner.run(TestRunner.java:57) at de.tmobile.cs.db.AutomaticQueryTest.main(AutomaticQueryTest.java:150) Caused by: <AST>:0:0: unexpected AST node: . at org.hibernate.hql.antlr.HqlSqlBaseWalker.identifier(HqlSqlBaseWalker.java:1754) at org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:1992) at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:933) at org.hibernate.hql.antlr.HqlSqlBaseWalker.orderExprs(HqlSqlBaseWalker.java:1190) at org.hibernate.hql.antlr.HqlSqlBaseWalker.orderClause(HqlSqlBaseWalker.java:1166) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:449) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189) ... 32 more

    Hibernate JIRA | 1 decade ago | Roland Scheel
    org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: . [ from AnyObject obj order by anypackage.anyfunction(obj.id) ]
  2. 0

    CREATE OR REPLACE PACKAGE anypackage IS function anyfunction return number; END; / CREATE OR REPLACE PACKAGE body anypackage IS function anyfunction return number is BEGIN return 0; END; END; <query name="anyquery"><![CDATA[ from AnyObject obj order by anypackage.anyfunction(obj.id) ]]> </query> Exception at Runtime: 11:17:46,574 ERROR SessionFactoryImpl:298 - Error in named query: anyquery org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: . [ from AnyObject obj order by anypackage.anyfunction(obj.id) ] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:425) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:386) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:289) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055) at de.tmobile.cs.db.AbstractCSDatabase.<init>(AbstractCSDatabase.java:94) at de.tmobile.cs.db.CSDatabase.<init>(CSDatabase.java:13) at de.tmobile.cs.db.CSDatabase.getInstance(CSDatabase.java:24) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at de.tmobile.cs.dbrt.SessionFactoryProvider.<clinit>(SessionFactoryProvider.java:53) at de.tmobile.cs.db.AutomaticQueryTest.testQueries(AutomaticQueryTest.java:141) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at junit.framework.TestResult$1.protect(TestResult.java:106) at junit.framework.TestResult.runProtected(TestResult.java:124) at junit.framework.TestResult.run(TestResult.java:109) at junit.framework.TestCase.run(TestCase.java:118) at junit.framework.TestSuite.runTest(TestSuite.java:208) at junit.framework.TestSuite.run(TestSuite.java:203) at junit.textui.TestRunner.doRun(TestRunner.java:116) at junit.textui.TestRunner.doRun(TestRunner.java:109) at junit.textui.TestRunner.run(TestRunner.java:72) at junit.textui.TestRunner.run(TestRunner.java:57) at de.tmobile.cs.db.AutomaticQueryTest.main(AutomaticQueryTest.java:150) Caused by: <AST>:0:0: unexpected AST node: . at org.hibernate.hql.antlr.HqlSqlBaseWalker.identifier(HqlSqlBaseWalker.java:1754) at org.hibernate.hql.antlr.HqlSqlBaseWalker.functionCall(HqlSqlBaseWalker.java:1992) at org.hibernate.hql.antlr.HqlSqlBaseWalker.expr(HqlSqlBaseWalker.java:933) at org.hibernate.hql.antlr.HqlSqlBaseWalker.orderExprs(HqlSqlBaseWalker.java:1190) at org.hibernate.hql.antlr.HqlSqlBaseWalker.orderClause(HqlSqlBaseWalker.java:1166) at org.hibernate.hql.antlr.HqlSqlBaseWalker.query(HqlSqlBaseWalker.java:449) at org.hibernate.hql.antlr.HqlSqlBaseWalker.selectStatement(HqlSqlBaseWalker.java:201) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:151) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:189) ... 32 more

    Hibernate JIRA | 1 decade ago | Roland Scheel
    org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: . [ from AnyObject obj order by anypackage.anyfunction(obj.id) ]
  3. 0

    In migration from Hibernate 2.1.6 to Hibernate 3.0, a named query stopped working. It referenced a string constant. The reported error was a syntax error. Example HSQL: from Foo foo where foo.status = foo.bar.Foo.STATUS_APPROVED [ Foo.STATUS_APPROVED = new Character('A') ] Error: 18/04/2005 17:16:38 org.hibernate.impl.SessionFactoryImpl <init> SEVERE: Error in named query: Booking.getCheckinsForDay org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: 'A' [ from Foo foo where foo.status = foo.bar.Foo.STATUS_APPROVED ] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63) at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:180) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:146) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:375) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054) at foo.bar.HibernateConfigTest.testCreateSessionFactory(HibernateConfigTest.java:152) ... The workaround (once the error message is diagnosed) seems to be to place the constant in quotes. However, I'm yet to be able to test it to see if this does the job, or if it merely makes it look for the constant name instead. Possibly-good HSQL: from Foo foo where foo.status = 'foo.bar.Foo.STATUS_APPROVED' This was not a problem under Hibernate 2.1.6

    Hibernate JIRA | 1 decade ago | Robert Watkins
    org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: 'A' [ from Foo foo where foo.status = foo.bar.Foo.STATUS_APPROVED ]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    In migration from Hibernate 2.1.6 to Hibernate 3.0, a named query stopped working. It referenced a string constant. The reported error was a syntax error. Example HSQL: from Foo foo where foo.status = foo.bar.Foo.STATUS_APPROVED [ Foo.STATUS_APPROVED = new Character('A') ] Error: 18/04/2005 17:16:38 org.hibernate.impl.SessionFactoryImpl <init> SEVERE: Error in named query: Booking.getCheckinsForDay org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: 'A' [ from Foo foo where foo.status = foo.bar.Foo.STATUS_APPROVED ] at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63) at org.hibernate.hql.ast.QueryTranslatorImpl.generate(QueryTranslatorImpl.java:180) at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:146) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414) at org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:375) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:278) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1054) at foo.bar.HibernateConfigTest.testCreateSessionFactory(HibernateConfigTest.java:152) ... The workaround (once the error message is diagnosed) seems to be to place the constant in quotes. However, I'm yet to be able to test it to see if this does the job, or if it merely makes it look for the constant name instead. Possibly-good HSQL: from Foo foo where foo.status = 'foo.bar.Foo.STATUS_APPROVED' This was not a problem under Hibernate 2.1.6

    Hibernate JIRA | 1 decade ago | Robert Watkins
    org.hibernate.hql.ast.QuerySyntaxError: unexpected AST node: 'A' [ from Foo foo where foo.status = foo.bar.Foo.STATUS_APPROVED ]
  6. 0

    Hibernate Community • View topic - object references an unsaved transient instance

    hibernate.org | 11 months ago
    org.hibernate.hql.ast.QuerySyntaxError: expecting "all", found 'join' near line 4, column 78 [ from org.openehr.rm.common.archetyped.Archetyped as at fetch join org.openehr.rm.support.identification.ArchetypeID as aId where aId.value = ? ]

    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. org.hibernate.hql.ast.QuerySyntaxError

      unexpected AST node: . [ from AnyObject obj order by anypackage.anyfunction(obj.id) ]

      at org.hibernate.hql.ast.ErrorCounter.throwQueryException()
    2. Hibernate HQL/JP-QL Parser
      QueryTranslatorImpl.compile
      1. org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
      2. org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
      3. org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
      4. org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
      4 frames
    3. Hibernate
      SessionFactoryImpl.<init>
      1. org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:425)
      2. org.hibernate.impl.SessionFactoryImpl.checkNamedQueries(SessionFactoryImpl.java:386)
      3. org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:289)
      3 frames
    4. Hibernate
      Configuration.buildSessionFactory
      1. org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
      1 frame
    5. de.tmobile.cs
      CSDatabase.getInstance
      1. de.tmobile.cs.db.AbstractCSDatabase.<init>(AbstractCSDatabase.java:94)
      2. de.tmobile.cs.db.CSDatabase.<init>(CSDatabase.java:13)
      3. de.tmobile.cs.db.CSDatabase.getInstance(CSDatabase.java:24)
      3 frames
    6. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    7. de.tmobile.cs
      AutomaticQueryTest.testQueries
      1. de.tmobile.cs.dbrt.SessionFactoryProvider.<clinit>(SessionFactoryProvider.java:53)
      2. de.tmobile.cs.db.AutomaticQueryTest.testQueries(AutomaticQueryTest.java:141)
      2 frames
    8. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    9. JUnit
      TestRunner.run
      1. junit.framework.TestCase.runTest(TestCase.java:154)
      2. junit.framework.TestCase.runBare(TestCase.java:127)
      3. junit.framework.TestResult$1.protect(TestResult.java:106)
      4. junit.framework.TestResult.runProtected(TestResult.java:124)
      5. junit.framework.TestResult.run(TestResult.java:109)
      6. junit.framework.TestCase.run(TestCase.java:118)
      7. junit.framework.TestSuite.runTest(TestSuite.java:208)
      8. junit.framework.TestSuite.run(TestSuite.java:203)
      9. junit.textui.TestRunner.doRun(TestRunner.java:116)
      10. junit.textui.TestRunner.doRun(TestRunner.java:109)
      11. junit.textui.TestRunner.run(TestRunner.java:72)
      12. junit.textui.TestRunner.run(TestRunner.java:57)
      12 frames
    10. de.tmobile.cs
      AutomaticQueryTest.main
      1. de.tmobile.cs.db.AutomaticQueryTest.main(AutomaticQueryTest.java:150)
      1 frame