-->
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.  [ 11 posts ] 
Author Message
 Post subject: Anyone use HibernateTools-3.1.0.beta4 with Oracle 9?
PostPosted: Mon Mar 20, 2006 1:55 am 
Beginner
Beginner

Joined: Mon Aug 15, 2005 9:00 pm
Posts: 37
Hello,

I have installed HibernateTools-3.1.0.beta4.zip with My Eclipse 3.1.1. Using the tool in Eclipse, I can create Hibernate Configuration file, but I cannot read anything out of my Oracle 9 DB, even though I am using the exact same conenction information as my present working Spring+Hiberate 3 application. Given this is a beta, I wonder has anyone tried what I did? any problem and solutions?

If this does not work any time soon, should I revert back to Hibernate 2 + Middlegen?

Thx
Chuck


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 20, 2006 6:13 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
If it works for Middlegen (and yes Middlegen support H3 - atleast in CVS) then there is no (obvious) reason it would not work for Hibernate tools.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Mar 20, 2006 12:47 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 9:00 pm
Posts: 37
Is there any logging I can turn on to see what went wrong?

Should I use the beta Eclipse plug in or should I use Middlegen for Hibernate 3?

If using Middlegen, The Middlegen for Hibernate I downloaded from Hibernate page (Middlegen-Hibernate-r5) still has its build.xml ref to net.sf.hibernate.tool.hbm2java.Hbm2JavaTas - Hiberante 2 stuff. Do you know where I can get Middlegen for Hibernate 3, or what is the build.xml I should use?

Thx,
Chuck


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 2:18 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 7:19 pm
Posts: 2364
Location: Brisbane, Australia
Get Middlegen from CVS for H3 support.

Secondly, Hibernate Tools should work once you have the JDBC driver setup correctly. I know it can be frustrating but don't give up to soon. Try reading the Ant tools docs which may help you get the configuration up and running.


http://www.hibernate.org/hib_docs/tools/reference/en/html/ant.html


Top
 Profile  
 
 Post subject: Why New Hibernate 3 Tools failed to read schema from Oracle
PostPosted: Tue Mar 21, 2006 5:54 am 
Beginner
Beginner

Joined: Mon Aug 15, 2005 9:00 pm
Posts: 37
David, Thx for the reply.

After reading Tools doc, I found the 2 logs:

metadata/.log
metadata/.plugins/org.hibernate.eclipse/hibernate-tools.log

hibernate-tools.log indicates connection to Oracle 9 has been establised successfully:

2006-03-21 01:23:24,062 535562 [ Worker-1] INFO riverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
2006-03-21 01:23:24,062 535562 [ Worker-1] INFO riverManagerConnectionProvider - Hibernate connection pool size: 20
2006-03-21 01:23:24,062 535562 [ Worker-1] INFO riverManagerConnectionProvider - autocommit mode: false
2006-03-21 01:23:24,062 535562 [ Worker-1] INFO riverManagerConnectionProvider - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@localhost:1521:chuckdb
2006-03-21 01:23:24,062 535562 [ Worker-1] INFO riverManagerConnectionProvider - connection properties: {user=scott, password=tiger}
2006-03-21 01:23:24,062 535562 [ Worker-1] DEBUG riverManagerConnectionProvider - total checked-out connections: 0
2006-03-21 01:23:24,062 535562 [ Worker-1] DEBUG riverManagerConnectionProvider - opening new JDBC connection
2006-03-21 01:23:24,156 535656 [ Worker-1] DEBUG riverManagerConnectionProvider - created connection to: jdbc:oracle:thin:@localhost:1521:chuckdb, Isolation Level: 2
2006-03-21 01:23:24,156 535656 [ Worker-1] DEBUG .hibernate.cfg.SettingsFactory - could not get database version from JDBC metadata
2006-03-21 01:23:24,156 535656 [ Worker-1] INFO .hibernate.cfg.SettingsFactory - RDBMS: Oracle, version: Oracle9i Enterprise Edition Release 9.0.1.1.1 - Production
With the Partitioning option
JServer Release 9.0.1.1.1 - Production
2006-03-21 01:23:24,171 535671 [ Worker-1] INFO .hibernate.cfg.SettingsFactory - JDBC driver: Oracle JDBC driver, version: 9.0.1.1.0
2006-03-21 01:23:24,171 535671 [ Worker-1] DEBUG riverManagerConnectionProvider - returning connection to pool, pool size: 1
2006-03-21 01:23:24,171 535671 [ Worker-1] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.Oracle9Dialect


But .log indicates trouble when I try to refresh the Database icon in the Eclipse's "Hibernate Configurations" view:

!MESSAGE DEBUG Worker-1 org.hibernate.cfg.reveng.dialect.JDBCMetaDataDialect - getTables(null.null.null)

!ENTRY org.hibernate.eclipse 1 10000 2006-03-21 01:23:24.234
!MESSAGE DEBUG Worker-1 org.hibernate.connection.DriverManagerConnectionProvider - total checked-out connections: 0

!ENTRY org.hibernate.eclipse 1 10000 2006-03-21 01:23:24.234
!MESSAGE DEBUG Worker-1 org.hibernate.connection.DriverManagerConnectionProvider - using pooled JDBC connection, pool size: 0

!ENTRY org.hibernate.eclipse 1 10000 2006-03-21 01:23:24.750
!MESSAGE DEBUG Worker-1 org.hibernate.connection.DriverManagerConnectionProvider - returning connection to pool, pool size: 1

!ENTRY org.hibernate.eclipse.console 4 4 2006-03-21 01:23:24.750
!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:null
Configured catalog:null
Available schemas:
AURORA$JIS$UTILITY$
AURORA$ORB$UNAUTHENTICATED
CTXSYS
DBSNMP
HR
MDSYS
OE
OLAPDBA
OLAPSVR
OLAPSYS
ORDPLUGINS
ORDSYS
OSE$HTTP$ADMIN
OUTLN
PM
QS
QS_ADM
QS_CB
QS_CBADM
QS_CS
QS_ES
QS_OS
QS_WS
RMAN
SCOTT
SH
SYS
SYSTEM
WKSYS
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: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)
... 10 more
!SUBENTRY 1 org.hibernate.eclipse.console 4 150 2006-03-21 01:23:24.750
!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: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)


Have you seen anything like this before? I don't know how to dump out the SQL the tools sends to Oracle, so I don't know which column it is complaining about. Any idea what I configured wrong? Any tips on how to debug this?

FYI, my hibernate.cfg.xml is:

<?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="test7">
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="hibernate.connection.password">tiger</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@localhost:1521:chuckdb</property>
<property name="hibernate.connection.username">scott</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</property>
</session-factory>
</hibernate-configuration>



Thx in advance,
Chuck


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 12:41 pm 
Beginner
Beginner

Joined: Mon Jun 06, 2005 6:48 pm
Posts: 45
I have gotten ant scripts to work to read the oracle database and create hibernate mapping files and java objects. I did run into significant issues along the way and the hibernate tools team fixed most of them but did run into serious issues with cacade support in the tool. where it appeared writes did not work for cascades and can not remember about reads having issues with sets not working.

Main remaining issue with tools was cascades not supported through reverse engineering unless you modified a template file in the tools jar I believe. Of course with each update of tools you loose changes so I stopped using hibernate and went back to plain old JDBC where I could.

Just not sure Hibernate overall ready for production usage.


Good Luck,
-Tony


Top
 Profile  
 
 Post subject:
PostPosted: Tue Mar 21, 2006 1:35 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 9:00 pm
Posts: 37
Hi Tony,

Thanks for the reply. Did you tried the Plugin for Eclipse?

Right now I only want to experiment auto-generation of mapping files from Oracle. I have over 300 tables in my design. I would be happy if it can get 80-90% correct.

I am new to Hibernate and its tools (including Ant). how do you set up Ant (especially what's different from its Html docs, apart for DB url/username/password, of course). I am using hibernate 3.1. Eclipse 3.1.1 and Oracle 9i.

From your experience, If you have tried Middlegen, is it a better tool to go with (at least for now)?

For the new Eclipse plugin, I am afraid that I might have to find their source code and dig into that to figure out what went wrong.

Thx in advance
Chuck


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 1:25 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
use a more uptodate driver which obeys the jdbc spec with respect to the columns that must be available in the getTables resultset.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject: Which Oracle DB version / JDBC version tested working?
PostPosted: Wed Mar 22, 2006 3:31 pm 
Beginner
Beginner

Joined: Mon Aug 15, 2005 9:00 pm
Posts: 37
Hi Max,

Which Oracle DB version / JDBC version you guys have tested and working with the new Hibernate Tools? I rather download the one you have tested that working.

Thx,
Chuck


Top
 Profile  
 
 Post subject:
PostPosted: Wed Mar 22, 2006 5:42 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if have runned it successfully on oracle 8,9,10 with the latest jdbc drivers (which is at version 10 i expect)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Mar 24, 2006 1:15 am 
Beginner
Beginner

Joined: Mon Aug 15, 2005 9:00 pm
Posts: 37
Thx a lot, Max. You are right that schema name is case sensitive. Fixing this name and I can get tables from Oracle now!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 11 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.