my dog learned polymorphism
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
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: 15

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

Joined: Mar 07, 2010
Posts: 1682

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: 859

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..

I agree. Here's the link:
subject: JPA - generate schema is possible?
It's not a secret anymore!