manash
manash

Reputation: 7106

DDL generation with Hibernate 4

When you write an application that uses Hibernate, and that you define your model starting with classes, how do you generate the script that contains the DDL to setup the database?

I know there is a Hibernate tool hbm2ddl that may be used for that but I can't find it for the latest version of Hibernate (4.1.6).

Also, in the developers guide (v4.1.6), I've seen there is a tool called SchemaExport that is used to generate DDL from mappings.

Thanks

Upvotes: 1

Views: 802

Answers (2)

wutzebaer
wutzebaer

Reputation: 14865

Hibernate automatically creates the tables if you set

hibernate.hbm2ddl.auto=update

Upvotes: 0

Jon Burgess
Jon Burgess

Reputation: 2115

Liquibase will most likely do what you want. According to their manual page on hibernate, it will do a better job than hbm2ddl - I have not used hbm2ddl so I can't back up their claim.

Upvotes: 1

Related Questions