Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA - generate schema is possible?

 
andrew sydor
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

How I can generate a database schema using JPA?
example. Hibernate plugin hbm2ddl ?
 
Bill Gorder
Bartender
Posts: 1682
7
Android IntelliJ IDE Linux Mac OS X Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 (hibernate.hbm2ddl.auto) to have it generate your ddl.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..


WP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic