Alex Rivera | Logout

Generate JPA 2 Entities from existing Database

Asked 2011-04-29T14:23:42.760
40

How can I generate JPA2 compliant @Entity from existing Databases?.

I found this: Question

Still its not clear if JBoss will generate compliant JPA2 and also I would like to know if there is a vendor independent way to do this.

Edit
Report

2 Answers

5

There is an option in the Netbeans IDE to generate entities from a database.

answered 2012-12-18T13:38:28.350
4

You should have a look at minuteproject on this track reverse-engineering for JPA2. It is a vendor independent tool. In release 0.5.5 it generates:

  • JPA2 entities (for table and views) and associated metamodel
  • persistence.xml (only hibernate configuration is available in 0.5.5) but you can overwrite it.
  • maven pom with querydsl integration
  • Enum classes (if specified at enrichment i.e. in config file).

I have not tried it with H2 but to do this you need to

  • add the H2 jdbc driver in $MP_HOME/application/lib/extra
  • add the driver class and your connection parameters in MinuteProject configuration.
answered 2011-06-28T20:12:49.627

Your Answer