File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA - generate schema is possible?

 
andrew sydor
Greenhorn
Posts: 15
  • 0
  • 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
  • 0
  • 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
  • 0
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic