Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate object @Entities from database?

I want to generate JPA's @Entitys from database (but I want it to be object oriented). for Example

@Entity
@Table(name = "badges")
public class Badges implements java.io.Serializable {

    private Integer id;
    private User user;
    private String name;
    private String date;

It would be cool if it also support ManyToOne, OneToMany, Parent and ManyToMany.

P.S. I tried JBoss Tools(Hibernate Tools) and I did not work for me.

like image 891
IAdapter Avatar asked Dec 30 '10 15:12

IAdapter


People also ask

How do I generate entities from an existing database in IntelliJ?

Generate a database entityClick Code | Generate or press Alt+Insert . Select the entity that you want to generate and press Enter .

How eclipse generate entities from an existing database using JPA?

Right-click the JPA project in the Project Explorer and select JPA Tools > Generate Entities from Tables. On the Select Tables page of the Generate Entities from Tables wizard, select your database connection and schema. To create a new database connection, click Add connection.


1 Answers

Use JBoss Tools (formerly hibernate tools).

Quote from their site:

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 59
Sean Patrick Floyd Avatar answered Sep 20 '22 15:09

Sean Patrick Floyd