7

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.

1 Answer 1

9

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!

Sign up to request clarification or add additional context in comments.

4 Comments

I tried, but I was not able to configure it :( and when I did it It just did not generate the files.
Make sure you have the latest version of the jboss tools and follow this tutorial: docs.jboss.org/tools/3.1.0.GA/en/hibernatetools/html/…
I have 3.2.0, maybe It just doesnt support MySQL. However I dont see any pictures there that shows it generates object oriented @entities(I get it to generate @entities with fields like Integer userId).
@01: a) MySQL is supported if you supply the mysql driver jar b) see the exporter section docs.jboss.org/tools/3.1.0.GA/en/hibernatetools/html/… : 'Generate EJB3 annotations' is what you want.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.