-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 
Author Message
 Post subject: Exception while generating code-Could not get list of tables
PostPosted: Mon Feb 26, 2007 11:58 am 
Newbie

Joined: Mon Feb 26, 2007 11:35 am
Posts: 3
I am getting the following when I try using reverse engineering to generate code and hbm files from my database(Oracle).

Code:
[b]Exception while generating code

Reason:
org.hibernate.exception.GenericJDBCException: Could not get list of tables from database. Probably a JDBC driver problem.

Configured Schema: XXX
Configured catalog: null

Available schemas:

XXX
YYY
XYXY
ZZZZ

[/b]


I am using Hibernate Tools 3.2.0 beta 9a and my eclipse version is 3.2.1
I have tried this with various JDBC drivers for oracle 8,9 an 10g but same error.

Anyone seen this before?

Tanay


Top
 Profile  
 
 Post subject: Same problem here. Cannot get list of tables from Oracle.
PostPosted: Mon Feb 26, 2007 4:20 pm 
Newbie

Joined: Tue Feb 20, 2007 4:14 pm
Posts: 8
I'm having the exact same problem. In our case the Oracle database is 8.1.17. I'm using the latest Oracle JDBC driver and the latest version of the Hibernate tools. (I'm actually running Ant from within Eclipse 3.2, but presumably that doesn't matter.) My connection info looks something like this:

hibernate.dialect = org.hibernate.dialect.OracleDialect
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.username = someuser
hibernate.connection.password = somepassword
hibernate.connection.url = jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = 1.2.3.4)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=someservice)))
hibernate.default_schema = someschema

I've had no problems getting this to work with our SQL Server database, but this is the first time I've tried it with our Oracle database.

The error message I get says:

Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
1. task: hbm2hbmxml (Generates a set of hbm.xml files)
An exception occurred while running exporter #2:hbm2hbmxml (Generates a set of hbm.xml files)
To get the full stack trace run ant with -verbose
org.hibernate.exception.GenericJDBCException: Could not get list of tables from database. Probably a JDBC driver problem.
Configured schema:someschema
Configured catalog:null
Available schemas:
[...snip...]
someschema
[...snip...]
Available catalogs:
java.sql.SQLException: Invalid column name

Anyone have any ideas? Is the problem simply that Oracle 8.1.17 won't provide database metadata information?


Top
 Profile  
 
 Post subject: New Driver Fixed Problem for Me
PostPosted: Tue Feb 27, 2007 12:12 pm 
Newbie

Joined: Tue Feb 20, 2007 4:14 pm
Posts: 8
I discovered that I had both the old classes12.jar and the new ojdbc14.jar files in my classpath. I removed the old one and suddenly it worked! (Well, in reality it didn't work, but I at least had a different problem at that point. I'll post about that in a different thread.)

Here's what I used.

some.db.properties:
hibernate.dialect = org.hibernate.dialect.OracleDialect
hibernate.connection.driver_class = oracle.jdbc.driver.OracleDriver
hibernate.connection.username = someuser
hibernate.connection.password = somepassword
hibernate.connection.url = jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS_LIST=(ADDRESS = (PROTOCOL = TCP)(HOST = 1.2.3.4)(PORT = 1521)))(CONNECT_DATA=(SERVICE_NAME=someservice)(SERVER=DEDICATED)))
hibernate.default_schema = someschema

some.reveng.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering SYSTEM
"http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">
<hibernate-reverse-engineering>
<schema-selection match-schema="someschema" />
<table-filter
match-schema="someschema"
match-name=".*"
package="somepackage" />
</hibernate-reverse-engineering>

This was for Oracle 8.1.17 using Java 5, Hibernate 3.2, and Eclipse 3.2.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 27, 2007 1:14 pm 
Newbie

Joined: Mon Feb 26, 2007 11:35 am
Posts: 3
WallyHartshorn, Thanks to your post, I got it to work as well.

Here is what I did.

1. Reinstalled the Hibernate tools 3.2.0 beta9a
2. Used both hibernate.cfg.xml as well as the reveng.xml file together.

Hibernate.cfg.xml file as below:
Code:
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
    <session-factory name="mySessionFactory">
        <!-- <property name="hibernate.bytecode.use_reflection_optimizer">false</property> -->
        <property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
        <property name="hibernate.connection.password">xxxxx</property>
        <property name="hibernate.connection.url">jdbc:oracle:thin:@<hostname>:<port>:<sid></property>
        <property name="hibernate.connection.username">yyyyyyy</property>
        <property name="hibernate.default_schema">SCHEMA</property>
        <property name="hibernate.dialect">org.hibernate.dialect.OracleDialect</property>
    </session-factory>
</hibernate-configuration>


hibernate.reveng.xml file as below:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering PUBLIC
   "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN"
   "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd">

<hibernate-reverse-engineering>
   <schema-selection match-schema="SCHEMA"/>
   <table-filter match-schema="SCHEMA" match-name=".*"/>
</hibernate-reverse-engineering>


The difference I see from what I was doing earlier is that the reverse engineering file has a table filter element now as well, as against having only the schema selection element earlier.

Tanay


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 19, 2007 10:55 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that reveng.xml should have zero effect since it's basically stating the same thing as the default behavoir.

don't know why you are getting an error.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: I am also getting the same error, found more details
PostPosted: Tue Apr 24, 2007 8:45 pm 
Newbie

Joined: Thu May 12, 2005 2:13 pm
Posts: 1
I think I found the issue. When I go to expand the database node (assuming it executes similar code) in hibernate configurations view I get the following detailed error in elcipse error log
java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:210)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:273)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:4383)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:667)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1374)
at org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect$1.convertRow(JDBCMetaDataDialect.java:33)
at org.hibernate.cfg.reveng.dialect.ResultSetIterator.next(ResultSetIterator.java:59)
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:196)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 2:12 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
update your jdbc driver to something recent that obeys the jdbc spec ;)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 3:55 am 
Beginner
Beginner

Joined: Mon Apr 23, 2007 8:30 am
Posts: 27
Location: India
I have the same issue and I have tried with a whole bunch of different JDBC drivers mentioned on the sun's site. Whichever driver I use, I am accurate in getting the following exception :-). Any suggestions on what is missing? My database is Oracle8i. Can anyone help with the correct JDBC driver? I guess the JDBC metadata support is required, looks like Hibernate Tools use JDBC metadata.

java.sql.SQLException: Invalid column name
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:114)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:156)
at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:219)
at oracle.jdbc.driver.OracleStatement.get_column_index(OracleStatement.java:3921)
at oracle.jdbc.driver.OracleResultSetImpl.findColumn(OracleResultSetImpl.java:661)
at oracle.jdbc.driver.OracleResultSet.getString(OracleResultSet.java:1308)
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:207)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:58)

Thanks,
Nikhil


Top
 Profile  
 
 Post subject:
PostPosted: Wed Apr 25, 2007 7:05 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
why are you looking on suns site for drivers to Oracle ?

Use an uptodate oracle10 jdbc driver (works fine with oracle8)

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.