I have 2 tables "book" & "customer " in the schema "myschema".
but when i try to fetch my data out of my tables, AT FIRST the following exception occured:
Code:
10:55:37,968 ERROR [JDBCExceptionReporter] Table 'myschema.myschema.__book' doesn't exist
10:55:37,968 INFO [STDOUT] org.hibernate.exception.SQLGrammarException: could not execute query using iterate
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:411)
at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:281)
at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:921)
at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:41)
at com.corp.biz.LibraryManager.getAllBooks(LibraryManager.java:37)
which myschema.myschema.__book seemed so weared. then, i found the problem in the book.hbm.xml file where i emptied the catalog tag as following:
Code:
<hibernate-mapping>
<class name="com.corp.biz.hibernate.mappings.Customer" table="customer" catalog="">
<id name="id" type="java.lang.Integer">
then the exception changed to:
Code:
10:55:37,968 ERROR [JDBCExceptionReporter] Table 'myschema.__book' doesn't exist
10:55:37,968 INFO [STDOUT] org.hibernate.exception.SQLGrammarException: could not execute query using iterate
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.hql.QueryLoader.iterate(QueryLoader.java:411)
at org.hibernate.hql.ast.QueryTranslatorImpl.iterate(QueryTranslatorImpl.java:281)
at org.hibernate.impl.SessionImpl.iterate(SessionImpl.java:921)
at org.hibernate.impl.QueryImpl.iterate(QueryImpl.java:41)
at com.corp.biz.LibraryManager.getAllBooks(LibraryManager.java:37)
But i still have myschema.__book and at this point, I can't remove the 2 additional underscores from the table name.
I also tried to extend the MySQLDialect class, it already has the code properly, I mean a dot as separator.
I'm using eclipse 3.1
MyEclipse 4.1.1 GA
MySQL 5
Hibernate 3