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?
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.
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With