# hibernate tools reverse engineering



## pblond (16. Oktober 2007)

Hallo zusammen,

seit Tagen versuche ich, das Hibernate Reverse Engineering aus den Hibernate Tools zum fliegen zu bringen. Leider werden immer nur Pojos und Mappings ohne Fremdschlüssel erzeugt. Hat einer eine Idee, was ich da falsch machen könnte?

Das Setup:

hibernate tools  3.2.0-beta11 
mysql 5.0.45-community-nt
mysql connector 5.07

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.dtd">
<hibernate-configuration>
    <session-factory name="mysql">
        <property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
        <property name="hibernate.connection.password">password</property>
        <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/mysql-db</property>
        <property name="hibernate.connection.username">dbuser</property>
        <property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
    </session-factory>
</hibernate-configuration>
```

hibernate.reveng.xml:


```
<?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>
</hibernate-reverse-engineering>
```

Tabellen:


```
CREATE TABLE TABLE_2 (
       TABLE2_ID INTEGER NOT NULL
     , PRIMARY KEY (TABLE2_ID)
)ENGINE=InnoDB;

CREATE TABLE TABLE_1 (
       TABLE1_ID INTEGER NOT NULL
     , TABLE2_ID INTEGER NOT NULL
     , PRIMARY KEY (TABLE1_ID)
)ENGINE=InnoDB;

ALTER TABLE TABLE_1
  ADD CONSTRAINT FK_TABLE_1_1
      FOREIGN KEY (TABLE2_ID)
      REFERENCES TABLE_2 (TABLE2_ID);
```

Ist bestimmt irgendwas total blödes... 
Vielen Dank im Vorraus!

Gruß-
PBlond


----------

