-->
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.  [ 4 posts ] 
Author Message
 Post subject: Reveng only shows primary keys
PostPosted: Fri Sep 25, 2009 8:01 pm 
Newbie

Joined: Fri Sep 25, 2009 7:40 pm
Posts: 3
Hi,

I am connecting to a mySQL database. In the reverse engineering.xml editor, I will see all the tables in the selected database, but only with the primary index fields. All the other fields are missing. When I run the code generation, no classes are generated.

The wierd thing is yesterday I managed to generate a table. I didnt know how to add a primary index to the table, so it didnt have one. But the table appeared and both fields were there. The code was generated, with a composite primary key containing both fields. The only thing I can see that I have done differently is add a primary key. But now even if I remove it, no code gets generated.

Heres my 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-name=".*"></table-filter>

</hibernate-reverse-engineering>


Heres my 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.session_factory_name">SessionFactory</property>
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/af</property>
        <property name="hibernate.connection.username">root</property>
        <property name="hibernate.default_catalog">af</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
        <property name="show_sql">true</property>
        <property name="hibernate.connection.pool_size">50</property>
        <property name="current_session_context_class">thread</property>
    </session-factory>
</hibernate-configuration>


Im just really confused now. How do I get all my tables to be generated?


Top
 Profile  
 
 Post subject: Re: Reveng only shows primary keys
PostPosted: Sat Sep 26, 2009 9:20 am 
Newbie

Joined: Fri Sep 25, 2009 7:40 pm
Posts: 3
To clarify, here is the Database Development view :

Image

Note the table Gung has columns id and Fung. Ming has id and Bong.


Here is the Hibernate view :

Image

These tables all just have the id column. Nothing else.


None of the tables are being generated.


Top
 Profile  
 
 Post subject: Re: Reveng only shows primary keys
PostPosted: Sat Sep 26, 2009 10:10 am 
Newbie

Joined: Fri Sep 25, 2009 7:40 pm
Posts: 3
Wooooohoooooooooo!

Right Ive sussed out the problem. It seems that the tools dont like Uppercase characters in the table name.

It seems similar to this problem here
http://opensource.atlassian.com/projects/hibernate/browse/HB-409

Although I am using Hibernate tools 3.2.4.GA and mySQL 5.1.38.. but maybe they use Schema Update or something... but whatever... I dont care, I can quite happily use lowercase letters. As long as it works!!

Is this a known issue? Is there anywhere where I should report it / document it to save others from the brain ache I had late into last night?


Thanks!


Top
 Profile  
 
 Post subject: Re: Reveng only shows primary keys
PostPosted: Mon Sep 28, 2009 9:06 am 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
hibernate tools treat table names the *exact* same way as the underlying JDBC driver does - hence why you might get different behavior on different databases and drivers.

It's a pain - and we should fix it with a "ignore what the jdbc driver says and just always use X"...but for now we do what the driver says.

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