Wednesday, April 23, 2014

hibernate.hbm2ddl.auto

  • Automatically validates or exports schema DDL to the database when the SessionFactory is created. With create-drop, the database schema will be dropped when the SessionFactory is closed explicitly.
http://docs.jboss.org/hibernate/core/3.3/reference/en/html/session-configuration.html#configuration-optional


  •     validate: validate the schema, makes no changes to the database.
    update: update the schema.
    create: creates the schema, destroying previous data.
    create-drop: drop the schema at the end of the session.
http://stackoverflow.com/questions/438146/hibernate-hbm2ddl-auto-possible-values-and-what-they-do


  • Hibernate creators discourage doing so in a production environment in their book "Java Persistence with Hibernate"

excerpt:
We've seen Hibernate users trying to use SchemaUpdate to update the schema of a production database automatically. This can quickly end in disaster and won't be allowed by your DBA.

http://stackoverflow.com/questions/221379/hibernate-hbm2ddl-auto-update-in-production

No comments:

Post a Comment