How to create a model from a database

I have an existing database. I need to create model classes in Java from it. Is there any tool / library that will allow me to do this. This will be very useful if he can emulate relations of entities in a database and in model classes.

This is acceptable if the tool / library works with only one database provider. I will create a database and then generate a model.

Thanks in advance.

EDIT: I will probably use Hibernate as an ORM structure if I manage to create a model.

+7
source share
4 answers

The Hibernate Tools project (available as an Eclipse plugin, as well as the Ant task) allows you to "reverse engineer" database schemas into the corresponding entity classes.

This project is also available in the JBoss Tools project .

The object allows reverse engineering of database metadata into a Hibernate configuration file. All artifacts (including .java files) are generated from this configuration file.

You can control the nature of the reverse development process according to your database structure. In other words, you can specify the patterns that you want to use to reverse the tool. You can also override JDBC type mappings, in addition to restricting the reverse engineering process to a selected set of tables.

Mandatory link:

+5
source

Telosys Tools does just that. Let's see: https://sites.google.com/site/telosystools/

Tutorials: https://sites.google.com/site/telosystutorial/ (it can also generate CRUD screens)

+3
source

Minuteproject 4 JPA2 ( http://minuteproject.wikispaces.com/JPA2 ) tracks this task. Minuteproject can be run from the console or command line.

You can get a quick result by creating from the console where you generate a maven project containing JPA2 mapping classes in java or groovy. If you use the command line, you need to fill out an xml file, which may contain additional customization of your generated code, such as packaging, listing, aliases, etc.

You can also try another track built on top of JPA2, such as DAO using spring or EJB; RECREATION; front end with Primefaces or Openxava; etc...

+1
source

Hibernate has a Hibernate plugin for Eclipse http://www.hibernate.org/subprojects/tools.html , which has reverse engineering capabilities.

See http://docs.jboss.org/tools/3.2.0.GA/en/hibernatetools/html/plugins.html#refeng_codegen for more details on how to start and configure the reverse development process.

0
source

All Articles