0

Is there any solution to get the full "CREATE TABLE"-Statement from an Entity in Hibernate?

I want to iterate through my Entities from my EntityManager and want to output the Statement for each Entity. Even Google didn't helped me, because there are only Topics where people want to automatically create the tables with hibernate.

I want to get these Statements so I can copy them and later execute them on another database.

Thanks and best regards!

  • Is *turning on `ddl-auto` and sql logging in hibernate, run your app against an empty DB, and get the create table statements from log* an acceptable solution? – Adrian Shum Mar 24 '17 at 08:17
  • and this seems also a possible solution: http://jandrewthompson.blogspot.hk/2009/10/how-to-generate-ddl-scripts-from.html – Adrian Shum Mar 24 '17 at 08:18
  • standard JPA API v2.1 provides properties to do just that, and there are ample references across the internet, or even ... (gasp) in the JPA spec –  Mar 24 '17 at 08:19

0 Answers0