views:

87

answers:

5

Are there any tools that can look at a database, and generate the basic mapping files?

It would be great if it could take a database, and create the actual model (java classes) with annotations, but not sure if that exists?

A: 

You might find what you need here, I found it on the fly: MyGeneration.

I know there are others that exist, but I don'T remember by heart. Hope this helps!

Will Marcouiller
+2  A: 

Take a look at ddl2hbm tools

Check Middlegen

Lombo
A: 

If you are using eclipse or ant...

Jboss tools

PaulP1975
+3  A: 

Hibernate 3 has a toolset called Hibernate Tools that provides an Eclipse plugin and an Ant task that both support Reverse Engineering:

Reverse Engineering: The most powerful feature of Hibernate Tools is a database reverse engineering tool that can generate domain model classes and Hibernate mapping files, annotated EJB3 entity beans, HTML documentation or even an entire JBoss Seam application in seconds!

...

Ant task: The Hibernate3 tools include a unified Ant task that allows you to run schema generation, mapping generation, or Java code generation as part of your build. See the documentation for more information.

For the Eclipse plugin, have a look at this section of the documentation. For the Ant task, have a look at the section about reverse engineering and optionally how to control it.

Note that other IDEs also provide support for reverse engineering (see Hibernate Reverse Engineering for Netbeans 6.5 and Generating Persistence Mappings from Database Schema for IntelliJ).

Pascal Thivent