Hi All,
I'm trying to reverse engineer an Oracle 9i schema using the hibernatetools Ant task running from Eclipse. I executes "successfully", although I get a warning and no code is generated. I'm using the example
here as a guide.
Here are my relevant bits:
hibernate-distribution-3.3.2.GA
HibernateTools-3.2.4.GA-R200905070146-H18
Eclipse version 3.5 NB - not congfigured with Hibernate plugins; I want to do everything through Ant
Oracle9i Release 9.2.0.6.0
build.xml:
Code:
<project name="proj" default="" basedir=".">
<property name="src.dir" value="src"></property>
<path id="toolslib">
<path location="lib/hibernate-tools.jar" />
<path location="lib/hibernate3.jar" />
<path location="lib/freemarker.jar" />
<path location="lib/ojdbc14.jar" />
<path location="lib/commons-logging-1.0.4.jar" />
<path location="lib/dom4j-1.6.1.jar" />
<path location="lib/slf4j-api-1.5.8.jar" />
<path location="lib/slf4j-simple-1.5.8.jar" />
</path>
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib" />
<hibernatetool destdir="${src.dir}/generated">
<jdbcconfiguration configurationfile="hibernate.cfg.xml"/>
<hbm2java jdk5="true"/>
<hbm2hbmxml destdir="${src.dir}/hbm" />
</hibernatetool>
</project>
hibernate.cfg.xml:
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>
<!-- Database connection settings -->
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@server:port:instance</property>
<property name="connection.username">username</property>
<property name="connection.password">passwd</property>
<property name="default_schema">schema</property>
<!-- JDBC connection pool (use the built-in) -->
<property name="connection.pool_size">1</property>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.Oracle9iDialect</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- Drop and re-create the database schema on startup -->
<!--
<property name="hbm2ddl.auto">update</property>
<mapping resource="org/hibernate/tutorial/domain/Event.hbm.xml"/>
-->
</session-factory>
</hibernate-configuration>
Stack trace:
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] 16 [main] INFO org.hibernate.cfg.Environment - Hibernate 3.3.2.GA
[hibernatetool] 16 [main] INFO org.hibernate.cfg.Environment - hibernate.properties not found
[hibernatetool] 16 [main] INFO org.hibernate.cfg.Environment - Bytecode provider name : javassist
[hibernatetool] 16 [main] INFO org.hibernate.cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] 63 [main] INFO org.hibernate.cfg.Configuration - configuring from file: hibernate.cfg.xml
[hibernatetool] 94 [main] INFO org.hibernate.cfg.Configuration - Configured SessionFactory: null
[hibernatetool] 110 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] 110 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - Hibernate connection pool size: 1
[hibernatetool] 110 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - autocommit mode: false
[hibernatetool] 125 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@server:port:instance
[hibernatetool] 125 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - connection properties: {user=username, password=****}
[hibernatetool] 391 [main] INFO org.hibernate.cfg.SettingsFactory - RDBMS: Oracle, version: Oracle9i Release 9.2.0.6.0 - Production
[hibernatetool] JServer Release 9.2.0.6.0 - Production
[hibernatetool] 391 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC driver: Oracle JDBC driver, version: 9.2.0.3.0
[hibernatetool] 406 [main] INFO org.hibernate.dialect.Dialect - Using dialect: org.hibernate.dialect.Oracle9iDialect
[hibernatetool] 438 [main] WARN org.hibernate.cfg.SettingsFactory - Could not obtain connection metadata
[hibernatetool] java.sql.SQLException: Unsupported feature
[hibernatetool] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
[hibernatetool] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
[hibernatetool] at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
[hibernatetool] at oracle.jdbc.dbaccess.DBError.throwUnsupportedFeatureSqlException(DBError.java:690)
[hibernatetool] at oracle.jdbc.OracleDatabaseMetaData.supportsGetGeneratedKeys(OracleDatabaseMetaData.java:4182)
[hibernatetool] at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:123)
[hibernatetool] at org.hibernate.cfg.Configuration.buildSettingsInternal(Configuration.java:2119)
[hibernatetool] at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2111)
[hibernatetool] at org.hibernate.cfg.JDBCMetaDataConfiguration.readFromJDBC(JDBCMetaDataConfiguration.java:40)
[hibernatetool] at org.hibernate.tool.ant.JDBCConfigurationTask.doConfiguration(JDBCConfigurationTask.java:83)
[hibernatetool] at org.hibernate.tool.ant.ConfigurationTask.getConfiguration(ConfigurationTask.java:55)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.getConfiguration(HibernateToolTask.java:302)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.getProperties(HibernateToolTask.java:318)
[hibernatetool] at org.hibernate.tool.ant.ExporterTask.configureExporter(ExporterTask.java:94)
[hibernatetool] at org.hibernate.tool.ant.Hbm2JavaExporterTask.configureExporter(Hbm2JavaExporterTask.java:34)
[hibernatetool] at org.hibernate.tool.ant.ExporterTask.execute(ExporterTask.java:39)
[hibernatetool] at org.hibernate.tool.ant.HibernateToolTask.execute(HibernateToolTask.java:186)
[hibernatetool] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[hibernatetool] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[hibernatetool] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[hibernatetool] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[hibernatetool] at java.lang.reflect.Method.invoke(Method.java:597)
[hibernatetool] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[hibernatetool] at org.apache.tools.ant.Task.perform(Task.java:348)
[hibernatetool] at org.apache.tools.ant.Target.execute(Target.java:357)
[hibernatetool] at org.apache.tools.ant.helper.ProjectHelper2.parse(ProjectHelper2.java:142)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.parseBuildFile(InternalAntRunner.java:191)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:400)
[hibernatetool] at org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:137)
[hibernatetool] 438 [main] INFO org.hibernate.transaction.TransactionFactoryFactory - Using default transaction strategy (direct JDBC transactions)
[hibernatetool] 438 [main] INFO org.hibernate.transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Automatic session close at end of transaction: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch size: 15
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC batch updates for versioned data: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Scrollable result sets: enabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - JDBC3 getGeneratedKeys(): disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Connection release mode: auto
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Default schema: careview
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Default batch fetch size: 1
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Generate SQL with comments: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL updates by primary key: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Order SQL inserts for batching: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] 438 [main] INFO org.hibernate.hql.ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Query language substitutions: {}
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - JPA-QL strict compliance: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Second-level cache: enabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Query cache: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Cache region factory : org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge
[hibernatetool] 438 [main] INFO org.hibernate.cache.impl.bridge.RegionFactoryCacheProviderBridge - Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Optimize cache for minimal puts: disabled
[hibernatetool] 438 [main] INFO org.hibernate.cfg.SettingsFactory - Structured second-level cache entries: disabled
[hibernatetool] 453 [main] INFO org.hibernate.cfg.SettingsFactory - Echoing all SQL to stdout
[hibernatetool] 453 [main] INFO org.hibernate.cfg.SettingsFactory - Statistics: disabled
[hibernatetool] 453 [main] INFO org.hibernate.cfg.SettingsFactory - Deleted entity synthetic identifier rollback: disabled
[hibernatetool] 453 [main] INFO org.hibernate.cfg.SettingsFactory - Default entity-mode: pojo
[hibernatetool] 453 [main] INFO org.hibernate.cfg.SettingsFactory - Named query checking : enabled
[hibernatetool] 485 [main] INFO org.hibernate.connection.DriverManagerConnectionProvider - cleaning up connection pool: jdbc:oracle:thin:@cx_full_demo:1521:so9i
[hibernatetool] 13-Jul-2009 11:22:51 org.hibernate.tool.Version <clinit>
[hibernatetool] INFO: Hibernate Tools 3.2.4.GA
[hibernatetool] 2. task: hbm2hbmxml (Generates a set of hbm.xml files)
BUILD SUCCESSFUL
Total time: 687 milliseconds
Any help much appreciated! I've looked for a solution to the "Could not obtain connection metadata" warning, but to no avail.
I'm very new at this, BTW....