net.sf.hibernate.exception.SQLGrammarException: Could not execute query

Hibernate JIRA | Abhishek Khandelwal | 1 decade ago
  1. 0

    The testJoinOpenBug produces incorrect query while testing hibernate with any type of database(hypersonic,mysql,postgresql). Define table alias for Lower as lower0 but refer to it as lower1 in the where clause. (no table/no field found exception is thrown by SQL). Here is the exception thrown: ============================================================= Could not execute query net.sf.hibernate.exception.SQLGrammarException: Could not execute query at net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:69) at net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29) at net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4131) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1557) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1531) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1523) at org.hibernate.test.MultiTableTest.testJoinOpenBug(MultiTableTest.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at org.hibernate.test.TestCase.runTest(TestCase.java:107)Caused by: java.sql.SQLException: Column not found: LOWER1__1_.TOP in statement [select lower0_.id__ as id1_, lower0_.intprop as intprop2_, lower0_.other1 as other12_, lower0_.other3 as other32_, lower0_.foo as foo2_, lower0__1_.count_ as count_0_, lower0__1_.name as name0_, lower0__1_.address as address0_, lower0__1_.date_ as date_0_, lower0__1_.top as top0_ from leafsubclass lower0_ inner join rootclass lower0__1_ on lower0_.id__=lower0__1_.id1_, leafsubclass lower1_, rootclass top2_ where lower0__1_.id1_ is not null and top2_.id1_ is not null and ((lower(top2_.name)>'a' and lower0_.other3=lower1_.id__ and lower1__1_.top=top2_.id1_))] at org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source) at org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source) at org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source) at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:263) at net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:236) at net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:67) at net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:784) at net.sf.hibernate.loader.Loader.doQuery(Loader.java:269) at net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138) at net.sf.hibernate.loader.Loader.doList(Loader.java:1063) at net.sf.hibernate.loader.Loader.list(Loader.java:1054) at net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854) at net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554) ... 18 more =============================================================

    Hibernate JIRA | 1 decade ago | Abhishek Khandelwal
    net.sf.hibernate.exception.SQLGrammarException: Could not execute query
  2. 0

    Adding DataSource

    oreports | 1 decade ago | juniriola
    java.sql.SQLException: Unexpected token: LAST\_INSERT\_ID in statement \[SELECT LAST\_INSERT\_ID()\]
  3. 0

    Adding DataSource

    oreports | 1 decade ago | juniriola
    java.sql.SQLException: Unexpected token: LAST\_INSERT\_ID in statement \[SELECT LAST\_INSERT\_ID()\]
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Big Problem..Could not execute query..

    oreports | 1 decade ago | schneexy4
    java.sql.SQLException: Table not found: REPORT\_USER in statement \[select reportuser0\_.REPORTUSER\_ID as REPORTUS1\_, reportuser0\_.NAME as NAME, reportuser0\_.PASSWORD as PASSWORD, reportuser0\_.ADMIN as ADMIN, reportuser0\_.EXTERNAL\_ID as EXTERNAL5\_, reportuser0\_.EMAIL\_ADDRESS as EMAIL\_AD6\_, reportuser0\_.PDF\_EXPORT\_TYPE as PDF\_EXPO7\_ from REPORT\_USER reportuser0\_ where (reportuser0\_.NAME=? )\]
  6. 0

    how to run openreports-tomcat 0.9.0 in Linux

    oreports | 1 decade ago | slp1961
    java.sql.SQLException: Table not found: REPORT\_USER in statement \[select reportuser0\_.REPORTUSER\_ID as REPORTUS1\_, reportuser0\_.NAME as NAME, reportuser0\_.PASSWORD as PASSWORD, reportuser0\_.ADMIN as ADMIN, reportuser0\_.EXTERNAL\_ID as EXTERNAL5\_, reportuser0\_.EMAIL\_ADDRESS as EMAIL\_AD6\_, reportuser0\_.PDF\_EXPORT\_TYPE as PDF\_EXPO7\_ from REPORT\_USER reportuser0\_ where (reportuser0\_.NAME=? )\]

    8 unregistered visitors
    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.sql.SQLException

      Column not found: LOWER1__1_.TOP in statement [select lower0_.id__ as id1_, lower0_.intprop as intprop2_, lower0_.other1 as other12_, lower0_.other3 as other32_, lower0_.foo as foo2_, lower0__1_.count_ as count_0_, lower0__1_.name as name0_, lower0__1_.address as address0_, lower0__1_.date_ as date_0_, lower0__1_.top as top0_ from leafsubclass lower0_ inner join rootclass lower0__1_ on lower0_.id__=lower0__1_.id1_, leafsubclass lower1_, rootclass top2_ where lower0__1_.id1_ is not null and top2_.id1_ is not null and ((lower(top2_.name)>'a' and lower0_.other3=lower1_.id__ and lower1__1_.top=top2_.id1_))]

      at org.hsqldb.jdbc.jdbcUtil.throwError()
    2. HSQLDB
      jdbcConnection.prepareStatement
      1. org.hsqldb.jdbc.jdbcUtil.throwError(Unknown Source)
      2. org.hsqldb.jdbc.jdbcPreparedStatement.<init>(Unknown Source)
      3. org.hsqldb.jdbc.jdbcConnection.prepareStatement(Unknown Source)
      3 frames
    3. net.sf.hibernate
      SessionImpl.find
      1. net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:263)
      2. net.sf.hibernate.impl.BatcherImpl.getPreparedStatement(BatcherImpl.java:236)
      3. net.sf.hibernate.impl.BatcherImpl.prepareQueryStatement(BatcherImpl.java:67)
      4. net.sf.hibernate.loader.Loader.prepareQueryStatement(Loader.java:784)
      5. net.sf.hibernate.loader.Loader.doQuery(Loader.java:269)
      6. net.sf.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:138)
      7. net.sf.hibernate.loader.Loader.doList(Loader.java:1063)
      8. net.sf.hibernate.loader.Loader.list(Loader.java:1054)
      9. net.sf.hibernate.hql.QueryTranslator.list(QueryTranslator.java:854)
      10. net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1554)
      11. net.sf.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:69)
      12. net.sf.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
      13. net.sf.hibernate.impl.SessionImpl.convert(SessionImpl.java:4131)
      14. net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1557)
      15. net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1531)
      16. net.sf.hibernate.impl.SessionImpl.find(SessionImpl.java:1523)
      16 frames
    4. org.hibernate.test
      MultiTableTest.testJoinOpenBug
      1. org.hibernate.test.MultiTableTest.testJoinOpenBug(MultiTableTest.java:64)
      1 frame
    5. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      3 frames
    6. org.hibernate.test
      TestCase.runTest
      1. org.hibernate.test.TestCase.runTest(TestCase.java:107)
      1 frame