[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2258) Bad SQL Grammer: Implicit join when using r.fooClass.attributes[?]=?

Darryl Miles (JIRA) noreply at atlassian.com
Tue Nov 21 11:28:05 EST 2006


Bad SQL Grammer: Implicit join when using r.fooClass.attributes[?]=?
--------------------------------------------------------------------

         Key: HHH-2258
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2258
     Project: Hibernate3
        Type: Bug

  Components: core  
    Versions: 3.1.3    
 Environment: MySQL server this has been tested with.
    Reporter: Darryl Miles
    Priority: Critical
 Attachments: test_joinedmapfilter.zip

Please find this test case atteched to demonstrate the bug, maybe you can add to the hibernate distribution for future testing and piece of mind for me.

The error:

Testsuite: org.hibernate.test.joinedmapfilter.JoinedMapFilterTest
Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.498 sec

Testcase: testJoinedMapFilter took 0.495 sec
        Caused an ERROR
could not execute query
org.hibernate.exception.SQLGrammarException: could not execute query
        at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:67)
        at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
        at org.hibernate.loader.Loader.doList(Loader.java:2147)
        at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
        at org.hibernate.loader.Loader.list(Loader.java:2023)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
        at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
        at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at org.hibernate.test.joinedmapfilter.JoinedMapFilterTest.testJoinedMapFilter(JoinedMapFilterTest.java:116)
        at org.hibernate.test.TestCase.runTest(TestCase.java:250)
        at org.hibernate.test.TestCase.runBare(TestCase.java:316)
Caused by: java.sql.SQLException: Unknown table 'productdet1_' in where clause
        at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2928)
        at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1571)
        at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1666)
        at com.mysql.jdbc.Connection.execSQL(Connection.java:2994)
        at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:936)
        at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:1030)
        at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
        at org.hibernate.loader.Loader.getResultSet(Loader.java:1668)
        at org.hibernate.loader.Loader.doQuery(Loader.java:662)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
        at org.hibernate.loader.Loader.doList(Loader.java:2144)
        ... 25 more

SELECT r FROM com.company.Toplevel AS r WHERE r.toplevel=? AND rec.productDetail.attributes[?]=? 

Also my recent post: http://forum.hibernate.org/viewtopic.php?t=966374&start=0&postdays=0&postorder=asc&highlight=

This testcase has been tested with 3.1.3 and 3.2.0-ga.


2nd problem:

There is also another situation in the testcase which I found through serendipity which causes a NPE inside hibernate because I misspelled "r" as "rec".  Check out the commented out section and swap over the createQuery() lines to demonstrate that NPE.


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list