-->
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.  [ 10 posts ] 
Author Message
 Post subject: Tools in Eclipse not working for reverse engineering
PostPosted: Mon Nov 27, 2006 2:58 pm 
Newbie

Joined: Mon Nov 27, 2006 2:39 pm
Posts: 5
Hibernate Tools version: 3.2.0 beta 8
Hibernate version: 3.2.1
Eclipse version: 3.2
MySQL db version: 5.0.22
OS: Fedora Core 6

Installed Hibernate tools as per docs. Created Console config and hibernate.cfg.xml. Created hibernate.reveng.xml. Try to do reverse engineering of database and I see a progress meter zip by but nothing happens most of the time. Very occasionally, the reverse engineering works, but can't duplicate it. No errors thrown or any messages at all. Is the location of hibernate.cfg.xml and hibernate.reveng.xml significant? Sometimes when the tool does work, the file pointed to in the reveng.xml: box of the code generation config doesn't even exist. I have searched through the docs, faqs and forum but can't find a similar issue.

hibernate.reveng.xml:
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>
  <table-filter match-schema="tracker_rt" match-name=".*"/>
</hibernate-reverse-engineering>


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>
        <property name="hibernate.bytecode.use_reflection_optimizer">false</property>
        <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.password">******</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/tracker_rt</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    </session-factory>
</hibernate-configuration>


Any ideas appreciated,

Thanks,

TB


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 7:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
"most of the time" ?

what happens the other times ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 27, 2006 7:35 pm 
Newbie

Joined: Mon Nov 27, 2006 2:39 pm
Posts: 5
As I mentioned before, the reverse engineering works occasionally, generating the correct classes and xml files, but not reliably. The same configuration that works one time won't work every time. I would think that if the plugin encounters an error that it would display it, but I see no errors when it doesn't work.

Thanks,

TB


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 4:19 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
look in the error log view and see if something unforseen goes wrong...

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 28, 2006 11:18 am 
Newbie

Joined: Mon Nov 27, 2006 2:39 pm
Posts: 5
I did, that's how I know there are no error messages.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 4:29 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
the plugin is very "defensive" with respect to logging any error situation.

Thus I'm pretty confident that if something went wrong (e.g. execptions) then you would see it - either in a dialog or in the error log.

Have you tried and used ant and see if that works the same way ? (it uses the same code so...)

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 12:43 pm 
Newbie

Joined: Mon Nov 27, 2006 2:39 pm
Posts: 5
Ok, I tried using it from ant instead of eclipse. Here is the relevant ant info:

Code:
   
    <path id="HIB_LIB">
        <path location="${ECLIPSE_HOME}/plugins/org.hibernate.eclipse_3.2.0.beta8/lib/tools/hibernate-tools.jar" />
        <path location="${ECLIPSE_HOME}/plugins/org.hibernate.eclipse_3.2.0.beta8/lib/tools/freemarker.jar" />
        <path location="${ECLIPSE_HOME}/plugins/org.hibernate.eclipse_3.2.0.beta8/lib/tools/jtidy-r8-21122004.jar" />
        <path location="${HIB_HOME}/hibernate3.jar" />
        <path location="${MYSQL_JAR}" />
        <path location="${HIB_HOME}/lib/commons-logging-1.0.4.jar" />
        <path location="${HIB_HOME}/lib/dom4j-1.6.1.jar" />
        <path location="${HIB_HOME}/lib/cglib-2.1.3.jar" />
        <path location="${HIB_HOME}/lib/asm.jar" />
    </path>
...

    <target name="reveng" depends="init">
        <delete dir="${SRC}/dbapi/hibernate" />
        <mkdir dir="${SRC}/dbapi/hibernate/rt" />
        <mkdir dir="${SRC}/dbapi/hibernate/hist" />
        <hibernatetool destdir="${SRC}">
            <jdbcconfiguration configurationfile="${ETC}/hibernate.cfg.xml"
                               packagename="dbapi.hibernate.rt"
                               revengfile="${ETC}/rt.hibernate.reveng.xml"
                               detectmanytomany="true"
                               detectoptimisticlock="true" />
            <hbm2hbmxml />
            <hbm2ddl export="false"
                     update="false"
                     drop="false"
                     create="true"
                     outputfilename="../ddl/hib-tracker_rt.ddl"
                     format="true" />
            <hbm2java jdk5="true"
                      ejb3="false" />
            <hbm2cfgxml ejb3="false"/>
            <hbm2dao />
        </hibernatetool>
    </target>



I get no errors and it says build successful, but it only generates the hibernate.cfg.xml and hib-tracker_rt.ddl file. The ddl file is empty and the cfg.xml file has no mappings for the classes. No POJO .java files or dao's are generated.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Nov 29, 2006 1:02 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
put a log4j.properties in the classpath and you should see if it actually gets access to the db and if it does what it skips.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 11:49 am 
Newbie

Joined: Mon Nov 27, 2006 2:39 pm
Posts: 5
Well I setup the log4j.properties, but the tool seems to be using commons logging, not log4j as it is ignoring the log4j.properties. It still generates no java files or ddl. Here is the output from the buildfile:

Code:
Buildfile: build.xml

init:

reveng:
   [delete] Deleting directory /home/tbowen/workspace/DBAPI/src/dbapi/hibernate
    [mkdir] Created dir: /home/tbowen/workspace/DBAPI/src/dbapi/hibernate/rt
    [mkdir] Created dir: /home/tbowen/workspace/DBAPI/src/dbapi/hibernate/hist
[hibernatetool] Executing Hibernate Tool with a JDBC Configuration (for reverse engineering)
[hibernatetool] 1. task: hbm2hbmxml (Generates a set of hbm.xml files)
[hibernatetool] Nov 30, 2006 8:45:11 AM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: Hibernate 3.2.1
[hibernatetool] Nov 30, 2006 8:45:11 AM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: hibernate.properties not found
[hibernatetool] Nov 30, 2006 8:45:11 AM org.hibernate.cfg.Environment buildBytecodeProvider
[hibernatetool] INFO: Bytecode provider name : cglib
[hibernatetool] Nov 30, 2006 8:45:11 AM org.hibernate.cfg.Environment <clinit>
[hibernatetool] INFO: using JDK 1.4 java.sql.Timestamp handling
[hibernatetool] Nov 30, 2006 8:45:11 AM org.hibernate.cfg.Configuration configure
[hibernatetool] INFO: configuring from file: hibernate.cfg.xml
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.Configuration doConfigure
[hibernatetool] INFO: Configured SessionFactory: null
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.reveng.OverrideRepository addFile
[hibernatetool] INFO: Override file: /home/tbowen/workspace/DBAPI/etc/rt.hibernate.reveng.xml
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Using Hibernate built-in connection pool (not for production use!)
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: Hibernate connection pool size: 20
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: autocommit mode: false
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: using driver: org.gjt.mm.mysql.Driver at URL: jdbc:mysql://localhost:3306/tracker_rt
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.connection.DriverManagerConnectionProvider configure
[hibernatetool] INFO: connection properties: {user=root, password=****}
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: RDBMS: MySQL, version: 5.0.27
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC driver: MySQL-AB JDBC Driver, version: mysql-connector-java-5.0.4 ( $Date: 2006-10-19 17:47:48 +0200 (Thu, 19 Oct 2006) $, $Revision: 5908 $ )
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.MySQLDialect
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.transaction.TransactionFactoryFactory buildTransactionFactory
[hibernatetool] INFO: Using default transaction strategy (direct JDBC transactions)
[hibernatetool] Nov 30, 2006 8:45:12 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] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic flush during beforeCompletion(): disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Automatic session close at end of transaction: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC batch size: 15
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC batch updates for versioned data: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Scrollable result sets: enabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JDBC3 getGeneratedKeys(): enabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Connection release mode: auto
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Maximum outer join fetch depth: 2
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default batch fetch size: 1
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Generate SQL with comments: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Order SQL updates by primary key: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory createQueryTranslatorFactory
[hibernatetool] INFO: Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.hql.ast.ASTQueryTranslatorFactory <init>
[hibernatetool] INFO: Using ASTQueryTranslatorFactory
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query language substitutions: {}
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: JPA-QL strict compliance: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Second-level cache: enabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Query cache: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory createCacheProvider
[hibernatetool] INFO: Cache provider: org.hibernate.cache.NoCacheProvider
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Optimize cache for minimal puts: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Structured second-level cache entries: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Statistics: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Deleted entity synthetic identifier rollback: disabled
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.cfg.SettingsFactory buildSettings
[hibernatetool] INFO: Default entity-mode: pojo
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.connection.DriverManagerConnectionProvider close
[hibernatetool] INFO: cleaning up connection pool: jdbc:mysql://localhost:3306/tracker_rt
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.tool.Version <clinit>
[hibernatetool] INFO: Hibernate Tools 3.2.0.beta8
[hibernatetool] 2. task: hbm2ddl (Generates database schema)
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.dialect.Dialect <init>
[hibernatetool] INFO: Using dialect: org.hibernate.dialect.MySQLDialect
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[hibernatetool] INFO: Running hbm2ddl schema export
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[hibernatetool] INFO: writing generated schema to file: /home/tbowen/workspace/DBAPI/src/../ddl/hib-tracker_rt.ddl
[hibernatetool] Nov 30, 2006 8:45:12 AM org.hibernate.tool.hbm2ddl.SchemaExport execute
[hibernatetool] INFO: schema export complete
[hibernatetool] 3. task: hbm2java (Generates a set of .java files)
[hibernatetool] 4. task: cfg2cfgxml (Generates hibernate.cfg.xml)
Nov 30, 2006 8:45:13 AM org.hibernate.connection.DriverManagerConnectionProvider close
INFO: cleaning up connection pool: jdbc:mysql://localhost:3306/tracker_rt
[hibernatetool] 5. task: hbm2dao (Generates a set of DAOs)

BUILD SUCCESSFUL


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 30, 2006 4:18 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
commons loggings will pick up log4j.properties if it is placed in the root of the classpath.

remember to enable debug logging.

_________________
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.  [ 10 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.