-->
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.  [ 7 posts ] 
Author Message
 Post subject: code generation launcher: no code produced
PostPosted: Mon Apr 17, 2006 9:07 am 
Newbie

Joined: Mon Apr 17, 2006 8:02 am
Posts: 4
Hibernate version:
hibernate-3.1.3

HibernateTools version:
HibernateTools-3.1.0.beta4

Eclipse version:
Eclipse 3.1.1

Name and version of the database and java connector:
MySQL 5.0.1 alpha, mysql-connector-java-3.1.12

Mapping documents:
no mapping files (--> the problem)

Full stack trace of any exception that occurs:
no exception

-------

Hi community,
I've got a standard java command line application and I'd like to use hibernate to realize the persistence layer. I need to create mapping files first and then the POJOs. I decided to use the HibernateTools for this task.

I followed the HibernateTools reference documentation (http://www.hibernate.org/hib_docs/tools/reference/en/html/) and all worked fine. I created a Hibernate configuration file, a Hibernate Console configuration, set the Code Generation Launcher and edited my reveng.xml to set the general type mappings.
I hope that all of the important Hibernate libraries were placed into my lib directory and set up in "Java Build Path".
I was finally back at the point of "Exporters" (http://www.hibernate.org/hib_docs/tools/reference/en/html/plugins.html#d0e371) to run the code generation after having read the following chapters as well. Unfortunately nothing happend.

The database connection set in hibernate.cfg.xml is working because the database tree is shown in the hibernate configuration view. The type mappings could be set as well and they also need DB connection to show the columns' types.

Thanks in advance!
nibor


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 1:09 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
did you point to a database which actually had tables ?
did your schema/catalog setting match ?
what is in your cfg.xml and reveng.xml ?

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Mon Apr 17, 2006 1:47 pm 
Newbie

Joined: Mon Apr 17, 2006 8:02 am
Posts: 4
Quote:
did you point to a database which actually had tables ?

Yes, I did. The database pointed to contains tables. They are, for instance, visible in "Hibernate Console Perspective"-->"Hibernate Configurations" view-->"Database".

Quote:
did your schema/catalog setting match ?

The following code should take alle tables from my schema:
Code:
<table-filter match-schema="mySchema" match-name=".*"/>


Quote:
what is in your cfg.xml and reveng.xml ?


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.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.password">myPassword</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mySchema</property>
        <property name="hibernate.connection.username">myUser</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    </session-factory>
</hibernate-configuration>


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>
<type-mapping>
   <sql-type jdbc-type="VARCHAR" hibernate-type="java.lang.String" />
   <sql-type jdbc-type="INTEGER" hibernate-type="java.lang.Long"/>
   <sql-type jdbc-type="TIMESTAMP" hibernate-type="java.util.Date"/>
   <sql-type jdbc-type="CHAR" hibernate-type="java.lang.Boolean" length="1"/>
</type-mapping>
<table-filter match-schema="mySchema" match-name=".*"/>
</hibernate-reverse-engineering>


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 3:10 am 
Newbie

Joined: Mon Apr 17, 2006 8:02 am
Posts: 4
Hi, it's still not working.

By the way, opening the Hibernate configuration tree in the Hibernate Console perspective lets appear a warning in the error log:

Code:
Warning 2006-04-17 14:42:32.135 WARN Worker-0 net.sf.ehcache.config.Configurator - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: bundleresource://153/ehcache-failsafe.xml


The number behind "Worker-" changes.
Can this have something in common with my problem?

nibor


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 7:48 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
if you don't get any errors then your console configuration does not contain anything.

And are you sure "mySchema" is the correct case for the schema ?

Try and just remove that from hibernate.reveng.xml.

the warning is just a warning from ehcache. normal.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 4:11 pm 
Newbie

Joined: Mon Apr 17, 2006 8:02 am
Posts: 4
Unbelievable, you're right!

Removing
Code:
<table-filter match-schema="mySchema" match-name=".*"/>

caused that all mapping files and POJOs were created.
It seems to be wrong to choose my database in the table filters tab of my hibernate.reveng.xml... Now, working, the database appears as catalog attribute of the class element in my mapping files. Weird.

Nevertheless, many thanks!
nibor


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 20, 2006 5:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
probably because mysql is case sensitive here

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