Generate JPA 2 Entities from existing Database

前端 未结 9 905
春和景丽
春和景丽 2020-11-28 05:52

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

9条回答
  •  遥遥无期
    2020-11-28 05:56

    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.

提交回复
热议问题