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.  [ 16 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Problem with Hibernate tools via ant
PostPosted: Tue Aug 15, 2006 1:40 am 
Newbie

Joined: Tue Aug 15, 2006 1:16 am
Posts: 2
Location: South San Francisco
I tried to reverse engineer a db schema with the following setting.

------------------------------------------------------------------

file: build.xml

<project name="RNAiProject" default="rnai" basedir=".">
<!-- set global properties for this build -->
<property name="jdbcdriver" location="/usr/prop/bea/prod81/weblogic81/server/l
ib/ojdbc14.jar" />
<property name="src" location="/vb/Scicomp/jtang/projects/hibernate/rnai
/src" />
<property name="hibernate_home" location="/usr/local/tools/java/lib/plug
ins/org.hibernate.eclipse_3.2.0.beta6a" />

<path id="toolslib">
<fileset dir="${hibernate_home}/lib/tools">
<include name="**/*.jar" />
</fileset>
<fileset dir="${hibernate_home}/lib/hibernate">
<include name="**/*.jar" />
</fileset>
<pathelement location="${hibernate_home}/lib/hibernate/log4j-1.2.11.jar"
/>
<pathelement location="${jdbcdriver}" />
</path>


<target name="rnai" description="use Hibernate to reverse engineer rnai">
<taskdef name="hibernatetool"
classname="org.hibernate.tool.ant.HibernateToolTask"
classpathref="toolslib" />

<hibernatetool destdir="${src}">

<classpath refid="toolslib" />

<jdbcconfiguration
configurationfile="hibernate.cfg.xml"
packagename="com.genentech.bioinformatics"
>
</jdbcconfiguration>

<hbm2java/>
<hbm2dao/>

</hibernatetool>
</target>
</project>

-------------------------------------------------------------------------

file: hibernate.cfg.xml

<?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.dt
d">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">oracle.jdbc.driver.Or
acleDriver</property>
<property name="hibernate.connection.password">psword</property>
<property name="hibernate.connection.url">jdbc:oracle:thin:@tst1:1521
:tst1</property>
<property name="hibernate.connection.username">users</property>
<property name="hibernate.default_schema">rnai</property>
<property name="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect<
/property>
</session-factory>
</hibernate-configuration>

-------------------------------------------------------------------------------

I built the project with "ant -buildfile build.xml rnai". I was informed "BUILD SUCCESSFUL" by "ant". There was no exception. But there was no output in "src" directory either. Your help is greatly appreciated.

_________________
Jerry


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 3:14 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
so no tables/classes where found. Probably because the schema name should be in upper case for oracle to report metadata back correctly.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 9:57 am 
Newbie

Joined: Tue Aug 15, 2006 1:16 am
Posts: 2
Location: South San Francisco
I changed the schema to upper case, still no luck. Here is the verbose output from the build.

Apache Ant version 1.6.1 compiled on February 12 2004
Buildfile: build.xml
Detected Java version: 1.4 in: /usr/opt/java141/jre
Detected OS: OSF1
parsing buildfile /home/ruby/vb/Scicomp/jtang/projects/hibernate/rnai/config/build.xml with URI = file:///home/ruby/vb/Scicomp/jtang/projects/
hibernate/rnai/config/build.xml
Project base dir set to: /home/ruby/vb/Scicomp/jtang/projects/hibernate/rnai/config
Build sequence for target `rnai' is [rnai]
Complete build sequence is [rnai, ]

rnai:
dropping /usr/local/tools/java/lib/plugins/org.hibernate.eclipse_3.2.0.beta6a/lib/hibernate/log4j-1.2.11.jar from path as it doesn't exist
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
dropping /usr/local/tools/java/lib/plugins/org.hibernate.eclipse_3.2.0.beta6a/lib/hibernate/log4j-1.2.11.jar from path as it doesn't exist
[hibernatetool] 1. task: hbm2java (Generates a set of .java files)
[hibernatetool] Aug 15, 2006 6:46:23 AM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2 cr3
[hibernatetool] Aug 15, 2006 6:46:23 AM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] Aug 15, 2006 6:46:23 AM org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] Aug 15, 2006 6:46:24 AM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] Aug 15, 2006 6:46:25 AM org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] Aug 15, 2006 6:46:27 AM org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] Aug 15, 2006 6:46:28 AM org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: /home/ruby/vb/Scicomp/jtang/projects/hibernate/rnai/config/hibernate.reveng.xml
[hibernatetool] Aug 15, 2006 6:46:29 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] Aug 15, 2006 6:46:29 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] Aug 15, 2006 6:46:29 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] Aug 15, 2006 6:46:29 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: oracle.jdbc.driver.OracleDriver at URL: jdbc:oracle:thin:@biotst1:1521:biotst1
[hibernatetool] Aug 15, 2006 6:46:29 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=rnai, password=****}
[hibernatetool] Aug 15, 2006 6:46:32 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: Oracle, version: Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
[hibernatetool] With the Partitioning, Oracle Label Security, OLAP and Oracle Data Mining options
[hibernatetool] JServer Release 9.2.0.5.0 - Production
[hibernatetool] Aug 15, 2006 6:46:32 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: Oracle JDBC driver, version: 9.2.0.3.0
[hibernatetool] Aug 15, 2006 6:46:33 AM org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.Oracle9Dialect
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.transaction.TransactionManagerLookupFactory getTransactionManagerLookup
[hibernatetool] INFO: No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not
recommended)
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC batch size: 15
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC batch updates for versioned data: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: auto
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default schema: RNAI
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JPA-QL strict compliance: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] Aug 15, 2006 6:46:34 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] Aug 15, 2006 6:46:35 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] Aug 15, 2006 6:46:35 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] Aug 15, 2006 6:46:35 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] Aug 15, 2006 6:46:35 AM org.hibernate.connection.DriverManagerConnectionProvider close
[hibernatetool] INFO: cleaning up connection pool: jdbc:oracle:thin:@biotst1:1521:biotst1
[hibernatetool] Aug 15, 2006 6:46:36 AM org.hibernate.tool.hbm2x.Version <clinit>
[hibernatetool] INFO: Hibernate Tools 3.2.0.beta6a
[hibernatetool] 2. task: hbm2dao (Generates a set of DAOs)

BUILD SUCCESSFUL
Total time: 21 seconds


Any advice?

_________________
Jerry


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 15, 2006 10:03 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hmm...doesn't seem like reverse engineering is done at all.

could you try and enable debug loggigng ? (just put a log4j.properties with debug enabled into the classpath of the taskdef)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 9:43 am 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
max wrote:
hmm...doesn't seem like reverse engineering is done at all.

could you try and enable debug loggigng ? (just put a log4j.properties with debug enabled into the classpath of the taskdef)


Has this ever been solved? I'm having similar problems.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Sep 08, 2006 12:08 pm 
Newbie

Joined: Wed Sep 06, 2006 9:54 am
Posts: 9
Hello,

i also use oracle and everything works fine. here my "config"

directory-structure and jar's
Quote:
rig@/users/local/data/develop/hbm-tools> tree
.
|-- build.xml
|-- hibernate.cfg.xml
|-- hibernate.reveng.xml
|-- lib
| |-- asm-attrs.jar
| |-- asm.jar
| |-- cglib-2.1.3.jar
| |-- commons-collections-2.1.1.jar
| |-- commons-logging-1.0.4.jar
| |-- dom4j-1.6.1.jar
| |-- freemarker.jar
| |-- hibernate-tools.jar
| |-- hibernate3.jar
| |-- jdbc2_0-stdext.jar
| |-- jtidy-r8-21122004.jar
| |-- log4j-1.2.11.jar
| `-- ojdbc14.jar
|-- log4j.properties
`-- src

Hint: jar's are taken from "HibernateTools-3.2.0.beta7.zip" and "hibernate-3.1.3.tar.gz"

build.xml-File
Quote:
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="ProjectName" default="usage" basedir=".">
<!-- make environment useable -->
<property name="env" environment="env" value="env"/>
<!-- ***************************************************************************** -->
<path id="toolslib">
<path location="lib/hibernate-tools.jar" />
<path location="lib/hibernate3.jar" />
<path location="lib/freemarker.jar" />
<path location="lib/log4j-1.2.11.jar" />
<path location="lib/commons-logging-1.0.4.jar" />
<path location="lib/dom4j-1.6.1.jar" />
<path location="lib/cglib-2.1.3.jar" />
<path location="lib/commons-collections-2.1.1.jar" />
<path location="lib/jdbc2_0-stdext.jar" />
<path location="lib/asm-attrs.jar" />
<path location="lib/asm.jar" />
<path location="lib/ojdbc14.jar" />
<path location="lib/jtidy-r8-21122004.jar" />
<path location="" />
</path>
<!-- ***************************************************************************** -->
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask" classpathref="toolslib" />
<!-- ***************************************************************************** -->
<hibernatetool destdir="/users/local/data/develop/hbm-tools">
<jdbcconfiguration packagename="com.foo.bar" revengfile="hibernate.reveng.xml" configurationfile="hibernate.cfg.xml"/>
<hbm2hbmxml/>
</hibernatetool>
<!-- ***************************************************************************** - - >
<hibernatetool destdir="/users/local/data/develop/hbm-tools/src">
<configuration configurationfile="hibernate.cfg.xml"/>
<hbm2java />
</hibernatetool>
<! - - ***************************************************************************** -->
</project>



hibernate.reveng.xml-File
Quote:
<?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="ABC_SCHEMA"/>
</hibernate-reverse-engineering>



hibernate.cfg.xml-File
Quote:
<?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>
<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory name="java:hibernate/SessionFactory">
<property name="connection.driver_class">oracle.jdbc.driver.OracleDriver</property>
<property name="connection.url">jdbc:oracle:thin:@[host]:[port]:[db]</property>
<property name="connection.username">[user-name]</property>
<property name="connection.password">[user-password]</property>
<property name="dialect">org.hibernate.dialect.Oracle9Dialect</property>
<property name="show_sql">false</property>

<!-- Mapping files (needed for hbm2java) - - >
<mapping resource="table_1.hbm.xml" />
<mapping resource="table_2.hbm.xml" />
<! - - -->
</session-factory>
</hibernate-configuration>


hope, these helps

reguards
rig


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 16, 2006 4:15 am 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
rig wrote:
i also use oracle and everything works fine. here my "config"


Using your config makes no difference. But I see you use the jars differently, so I started copying stuff together from the hibernate and tools distributions.

It turns out that the hibernate3.jar in Hibernate 3.1.3 misses the org.hibernatie.egine.query.sql package, the version inside tools does.

And after copying a lot of jars into a lib directory, it new generates mydefintions.

Next step is to figure out where it goes wrong. To be continued.

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 16, 2006 4:32 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
you should always use the libraries that comes with hibernate tools; saves you from alot of trouble.

you can of course stil use H3.1.x for your hibernate core needs

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sat Sep 16, 2006 7:29 am 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
max wrote:
you should always use the libraries that comes with hibernate tools; saves you from alot of trouble.

you can of course stil use H3.1.x for your hibernate core needs


I used tools in my original -not working- setup. I first want to rollback stepwise to my original setup until it breaks again, so I can find out what went wrong.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 17, 2006 1:50 am 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
These are the moments I seriously doubt my own sanity. It appears to have just been the schema-selection tag in reveng.xml. But I know for certain I tried several settings (including no attributes at all).

Alas, it works.


Again, thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 17, 2006 4:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
<sarcasm>
yes, we try our best to write non-deterministic software.
</sarcasm>

In any case, nice to hear you succeded :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 17, 2006 3:33 pm 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
max wrote:
<sarcasm>
yes, we try our best to write non-deterministic software.
</sarcasm>

In any case, nice to hear you succeded :)


He he. I supposed hibernate heard me curse when it didn't work and decided to prolong my agony. Just to see how long I would push on until I posted at the forum... :-)

I'm a bit confused at the reveng algorithm: if I rev-eng from a DB, I cannot alter the generated java classes, since all my changes would be lost everytime rev-eng is run. So I expected a Cayenne alike inheritance setup to be generated (A extends B, where B is generated, but A is instantiated upon persistence). I know Hibernate can do this, but I cannot seems to find the correct tag in the hibernate documentation (should have saved the link), nor can I find any option in rev-eng to activate ít.

I'm amazed because I assume other people would have had the same expectancy. Or should I start doubting myself? Again. ;-)


Top
 Profile  
 
 Post subject:
PostPosted: Sun Sep 17, 2006 3:41 pm 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
I always find posts seconds after putting out the message to the forum. By max himself:

i plan on implementing this soon.

can be done today by adding <meta attribute="generated-class">PersonBase</meta> to the hbm.xml.

This is just not supported for reveng.xml yet.



All answered in one. So XSLT it is.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Sep 18, 2006 4:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
....or go on an submit a patch that implements it for you in reveng.xml ? :)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Sep 21, 2006 3:54 am 
Beginner
Beginner

Joined: Fri Sep 08, 2006 9:41 am
Posts: 23
max wrote:
....or go on an submit a patch that implements it for you in reveng.xml ? :)


AHA! Looking for help, are you? Okay, I'll download the Tools sources and see if I can get it to compile without moving the world (that usually keeps me form...) It is the better solution.

When I have some playtime again.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 16 posts ]  Go to page 1, 2  Next

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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.