facebook

Hibernate, MySQL: I get underscores before my table name

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #249888 Reply

    Mahan Hooshmand Rad
    Participant

    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:

    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:

    <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:

    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’m using eclipse 3.1
    MyEclipse 4.1.1 GA
    MySQL 5
    Hibernate 3

    Please Help. THANX

    #249894 Reply

    Haris Peco
    Member

    mahan_h ,

    hibernate 3.0.5 have bug with mysql catalogs.We fix it in 4.1.1, and i suppose that you use original hibernate jar or jar from older myeclipse (<4.1.1) – Please, use hibernate3.jar form MyEclipse 4.1.1 and try

    Thanks

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Hibernate, MySQL: I get underscores before my table name

You must be logged in to post in the forum log in