Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

generate java domain objects from database table

may i know in eclipse, is there any feature that will auto generate domain objects with all table relationship properly mapped in class?

can provide me with some reference articles on this?

like image 888
cometta Avatar asked May 19 '09 03:05

cometta


People also ask

What is a Java domain object?

The model has a central position in a play application. It's the domain-specific representation of the information on which the application operates. Martin fowler defines it as: Responsible for representing concepts of the business, information about the business situation, and business rules.

What is domain Modelling in Java?

A Domain model is a conceptual model of the problem domain. By "java domain model" they just mean the java classes representing that model. There's nothing specific to java in the concept. See also Domain Driven Design for an approach to focusing your development on the business domain needs.


3 Answers

You can use something like Hibernate to accomplish this

This plugin set for Eclipse called Hibernate Tools for Eclipse and ANT will do most of the work for you.

In particular it will do 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!

like image 175
Vinko Vrsalovic Avatar answered Oct 16 '22 04:10

Vinko Vrsalovic


Telosys code generator does this kind of job. It's an Eclipse plugin, it uses the database schema to create a light model that is used to generate the Java code.

There are some predefined templates available on GitHub (for JPA, POJO, Documentation, Spring MVC, etc )

See http://www.telosys.org

and http://marketplace.eclipse.org/content/telosys-tools

Templates : https://github.com/telosys-templates-v3

Articles about code generation with Telosys :

  • https://modeling-languages.com/telosys-tools-the-concept-of-lightweight-model-for-code-generation/
  • https://dzone.com/articles/telosys-a-code-generation-tool-by-laurent-guerin
like image 21
rlopez Avatar answered Oct 16 '22 03:10

rlopez


You can use Hibernate Tools 3.0.0.GA either via Eclipse or ANT to auto-generate your hibernate domain entities directly from your database tables.

See tutorial here : http://docs.jboss.org/tools/3.0.0.GA/en/hibernatetools/html_single/index.html

like image 32
Aries McRae Avatar answered Oct 16 '22 04:10

Aries McRae