File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Object Relational Mapping and the fly likes JPA - generate schema is possible? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "JPA - generate schema is possible?" Watch "JPA - generate schema is possible?" New topic

JPA - generate schema is possible?

andrew sydor

Joined: Oct 20, 2009
Posts: 5

How I can generate a database schema using JPA?
example. Hibernate plugin hbm2ddl ?
Bill Gorder

Joined: Mar 07, 2010
Posts: 1646

Yes. JPA is just a specification. You still need a persistence provider (implementation) like hibernate. If you use hibernate as your persistence provider you can still set the hibernate property ( to have it generate your ddl.

[How To Ask Questions][Read before you PM me]
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

From what I recall ... (I usually do it the other way from DB -> Classes)

In Eclipse J2EE, start a new JPA project.

Import your annotated Java POJOs (Well I guess they're not plain anymore ;))

Click with right mouse button, and it should give you the option to generate DB object from Classes.

You may have to do some DB configuration, connection properties etc..

It is sorta covered in the JavaRanch Style Guide.
subject: JPA - generate schema is possible?
Similar Threads
What is the difference between eclipseLink1.0 and eclipseLink2.0
JPA integration
Convert / Create Database schema from one database to another different database.
JAX-WS and Java Bean Validation from EE 6
Webpage not opening in eclipse