11 Replies Latest reply on Oct 9, 2006 11:08 AM by Max Rydahl Andersen

    Problems running Hibernate Code Generation

    Joshua Preston Newbie

      I'm attempting to generate some code based on our existing database and am having problems. It appears that I have everything setup properly, but am hitting a road block! ;-)

      Anyhow, I'm following the example at

      http://www.jboss.com/products/seam/SeamHBTools.html

      Our database is ORACLE, so I've modified the settings where applicable. When I attempt to configure the tables and try the "Refresh" the schemas, nothing happens. Further investigation into my ~/workspace/.metadata/.log shows the following stack trace:

      !ENTRY org.hibernate.eclipse.console 4 4 2006-03-06 16:07:39.56
      !MESSAGE Problem while reading database schema
      !STACK 0
      org.hibernate.exception.GenericJDBCException: Could not get list of tables from database. Probably a JDBC driver problem.
      Configured schema:ROUTER_USER
      Configured catalog:DB01
      Available schemas:
       AEP_USER
       ALGY_USER
       APP_STAT
       APP_USER
       AUS_USER
       AUTO_TELOR
       BGE_USER
       BILLUSER
       CAL_USER
       CAR_USER
       CATHI
       CDR_USER
       CGE_USER
       CIN_USER
       CLEC_USER
       CLK_USER
       CMANAGER
       COL_USER
       COMED
       CPL_USER
       CUSTDB_USER
       DBSNMP
       DEL_USER
       DET_USER
       DISPATCHER
       DOM_USER
       DPL_USER
       DQE_USER
       DUKE_USER
       ERC_USER
       EUG_USER
       FIR_USER
       FLI_USER
       FOO_USER
       FPC_USER
       FPL_USER
       GAR_USER
       GMP_USER
       GRY_USER
       GSA_USER
       HCE_USER
       HRP_USER
       HUD_USER
       INDE_USER
       IVR_USER
       JAX_USER
       JDBC
       JEAN
       KCP_USER
       KUB_USER
       LAK_USER
       LAN_USER
       LES_USER
       LISA
       LKY_USER
       LOAD_USER
       MAX_USER
       MEC_USER
       MEM_USER
       NATALIE
       NEU_USER
       NIE_USER
       NLR_USER
       NPP_USER
       NST_USER
       OBJ_USER
       OPD_USER
       OUTLN
       PAC_USER
       PE2_USER
       PEC_USER
       PED_USER
       PEP_USER
       PWC_USER
       RED_USER
       REL_USER
       REPADMIN
       REP_USER
       ROUTER_APPU
       ROUTER_USER
       SCEG_USER
       SCOTT
       SCP_USER
       SCS_USER
       SDB_USER
       SDE
       SDEDATA
       SFW_USER
       SMU_USER
       SOH_USER
       SQL_USER
       SRP_USER
       SWC_USER
       SYS
       SYSTEM
       TES_USER
       TEX_USER
       TFC_USER
       TRACESVR
       TSB_APP
       TSB_USER
       UCS_APPU
       UCS_USER
       UCU_USER
       UEL_USER
       UOP_USER
       VOI_USER
       WSR_USER
       WWW_USER
      Available catalogs:
      
       at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:91)
       at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:79)
       at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.handleSQLException(JDBCMetaDataDialect.java:86)
       at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:50)
       at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:400)
       at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:79)
       at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:70)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:39)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:31)
       at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70)
       at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
       at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
      Caused by: java.sql.SQLException: Invalid column name
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
       at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:4541)
       at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:666)
       at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1374)
       at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:79)
       at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:47)
       ... 10 more
      !SUBENTRY 1 org.hibernate.eclipse.console 4 150 2006-03-06 16:07:39.56
      !MESSAGE java.sql.SQLException: Invalid column name
      !STACK 0
      java.sql.SQLException: Invalid column name
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
       at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:4541)
       at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:666)
       at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1374)
       at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:79)
       at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:47)
       at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:400)
       at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:79)
       at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:70)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:39)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:31)
       at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70)
       at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
       at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
      !SUBENTRY 2 org.hibernate.eclipse.console 4 150 2006-03-06 16:07:39.57
      !MESSAGE java.sql.SQLException: Invalid column name
      !STACK 0
      java.sql.SQLException: Invalid column name
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:169)
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:211)
       at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:274)
       at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:4541)
       at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:666)
       at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1374)
       at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:79)
       at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:47)
       at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:400)
       at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:65)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:79)
       at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:35)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:70)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:39)
       at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:31)
       at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:70)
       at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:192)
       at org.eclipse.core.internal.jobs.Worker.run(Worker.java:76)
      


      Obviously, it is connecting from my perspective due to the fact that it is pulling all of the database schemas. I've also included the same Oracle JAR that I use for testing and installed in JBoss AS.

      Any ideas?

      Thanks,

      Joshua Preston

        • 1. Re: Problems running Hibernate Code Generation
          Max Rydahl Andersen Master

          looks like a bad version of the driver.

          • 2. Re: Problems running Hibernate Code Generation
            Joshua Preston Newbie

            Max,

            You are correct, downloading Oracle's newest JDBC driver did the trick!

            Thank you very much!

            Joshua Preston.

            • 3. Re: Problems running Hibernate Code Generation
              Chuck Zheng Newbie

              Hi Joshua and Max,

              I have the same problem. I've tried latest Oracle JDBC Driver 10.2 against my Oracle DB 9.1, but still the problem stays and no tables found from DB. Do I miss something? Any further logging I can tune/check to see what went wrong?

              Thx,
              Chuck

              • 4. Re: Problems running Hibernate Code Generation
                Max Rydahl Andersen Master

                maybe you have set default schema to something that does not match in the db ? (oracle is case sensitive)

                • 5. Re: Problems running Hibernate Code Generation
                  Ivan Saramandic Newbie

                   

                  "chuckzhg" wrote:
                  Hi Joshua and Max,

                  I have the same problem. I've tried latest Oracle JDBC Driver 10.2 against my Oracle DB 9.1, but still the problem stays and no tables found from DB. Do I miss something? Any further logging I can tune/check to see what went wrong?

                  Thx,
                  Chuck


                  I have the same problem, too. It seems to be generation problem with Oracle 9. I have tried with various latest driver libraries from oracle but it doesn't help! And it is not problem with default schema name because i have checked this. If I provide wrong default schema name, there is no exception (but generation cannot be used because table list is empty)!

                  Thanks



                  • 6. Re: Problems running Hibernate Code Generation
                    Nagaraja Manchikalapati Newbie

                    I am also getting the same error. I am using Oracle 10g and the lastest drivers (10g 10.1.0.2 ojdbc14_g.jar) from oracle site. But I am using JDK 1.5. The error might be happening because of JDK version.

                    Let me know which version you guys are using?


                    Configured schema:ROOT
                    Configured catalog:null
                    Available schemas:
                    ANONYMOUS
                    CTXSYS
                    DBSNMP
                    DIP
                    FLOWS_020100
                    FLOWS_FILES
                    HR
                    MDSYS
                    OUTLN
                    ROOT
                    SYS
                    SYSTEM
                    TSMSYS
                    XDB
                    Available catalogs:

                    at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
                    at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
                    at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.handleSQLException(JDBCMetaDataDialect.java:86)
                    at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:50)
                    at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:433)
                    at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:67)
                    at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:97)
                    at org.hibernate.console.execution.DefaultExecutionContext.execute(DefaultExecutionContext.java:56)
                    at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.readDatabaseSchema(LazyDatabaseSchemaWorkbenchAdapter.java:88)
                    at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter.getChildren(LazyDatabaseSchemaWorkbenchAdapter.java:57)
                    at org.hibernate.eclipse.console.workbench.BasicWorkbenchAdapter.fetchDeferredChildren(BasicWorkbenchAdapter.java:94)
                    at org.eclipse.ui.progress.DeferredTreeContentManager$1.run(DeferredTreeContentManager.java:207)
                    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)
                    Caused by: java.sql.SQLException: Invalid column name
                    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
                    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
                    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
                    at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:5278)
                    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:698)
                    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1505)
                    at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:79)
                    at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:47)
                    ... 9 more
                    !SUBENTRY 2 org.hibernate.eclipse.console 4 150 2006-08-24 14:24:49.429
                    !MESSAGE java.sql.SQLException: Invalid column name
                    !STACK 0
                    java.sql.SQLException: Invalid column name
                    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:180)
                    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:222)
                    at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:285)
                    at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:5278)
                    at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:698)
                    at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1505)
                    at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:79)
                    at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:47)
                    at org.hibernate.cfg.reveng.JDBCReader.processTables(JDBCReader.java:433)
                    at org.hibernate.cfg.reveng.JDBCReader.readDatabaseSchema(JDBCReader.java:67)
                    at org.hibernate.eclipse.console.workbench.LazyDatabaseSchemaWorkbenchAdapter$1.execute(LazyDatabaseSchemaWorkbenchAdapter.java:97)

                    • 7. Re: Problems running Hibernate Code Generation
                      Nagaraja Manchikalapati Newbie

                      It worked when I change the JDK to jdk142_04 instead of jdk1.5. The issue here is JDK. Not the jdbc driver. I hope Hibernate team will investigate further on this issue.

                      • 8. Re: Problems running Hibernate Code Generation
                        Max Rydahl Andersen Master

                        if you could give me a minimal schema to reproduce this on then please do.

                        The "invalid column name" is thrown by the oracle jdbc driver for one of the *standard* column names in jdbc metadata:

                        TABLE_NAME
                        TABLE_SCHEM (yes, SCHEM not SCHEMA)
                        TABLE_CAT
                        TABLE_TYPE
                        REMARKS

                        and there is no difference between these when running on jdk 1.4 or 1.5.

                        The only time i have been able to reproduce something like this is with "older" faulty jdbc drivers.

                        • 9. Re: Problems running Hibernate Code Generation
                          Tuan Anh Newbie

                          I am also getting the same error when I create Hibernate mapping from tables. I tried all of the above way but nothing effect. Can you help me ???

                          • 10. Re: Problems running Hibernate Code Generation
                            Max Rydahl Andersen Master

                            read my last reply and that would help...

                            • 11. Re: Problems running Hibernate Code Generation
                              Max Rydahl Andersen Master

                              read my last reply and answer accordingly.