What are the possible values of the Hibernate configuration and what do they do


I really want to know more about the update, export and the values that could be given to
I need to know when to use the update and when not? And what is the alternative?

These are changes that could happen over DB:

  • new tables
  • new columns in old tables
  • columns deleted
  • data type of a column changed
  • a type of a column changed its attributes
  • tables dropped
  • values of a column changed

In each case what is the best solution?

4/15/2019 3:24:13 PM

There's also the undocumented value of "none" to disable it entirely.


The configuration property is called

In our development environment we set to drop and create a clean database each time we deploy, so that our database is in a known state.

In theory, you can set to update your database with changes to your model, but I would not trust that on a production database. An earlier version of the documentation said that this was experimental, at least; I do not know the current status.

Therefore, for our production database, do not set - the default is to make no database changes. Instead, we manually create an SQL DDL update script that applies changes from one version to the next.


I would use liquibase for updating your db. hibernate's schema update feature is really only o.k. for a developer while they are developing new features. In a production situation, the db upgrade needs to be handled more carefully.


Although it is quite an old post but as i did some research on the topic so thought of sharing it.

As per the documentation it can have four valid values:

create | update | validate | create-drop

Following is the explanation of the behaviour shown by these value:

  • create :- create the schema, the data previously present (if there) in the schema is lost
  • update:- update the schema with the given values.
  • validate:- validate the schema. It makes no change in the DB.
  • create-drop:- create the schema with destroying the data previously present(if there). It also drop the database schema when the SessionFactory is closed.

Following are the important points worth noting:

  • In case of update, if schema is not present in the DB then the schema is created.
  • In case of validate, if schema does not exists in DB, it is not created. Instead, it will throw an error:- Table not found:<table name>
  • In case of create-drop, schema is not dropped on closing the session. It drops only on closing the SessionFactory.
  • In case if i give any value to this property(say abc, instead of above four values discussed above) or it is just left blank. It shows following behaviour:

    -If schema is not present in the DB:- It creates the schema

    -If schema is present in the DB:- update the schema.


First, the possible values for the hbm2ddl configuration property are the following ones:

  • none - No action is performed. The schema will not be generated.
  • create-only - The database schema will be generated.
  • drop - The database schema will be dropped and created afterwards.
  • create - The database schema will be dropped and created afterwards.
  • create-drop - The database schema will be dropped and created afterwards. Upon closing the the SessionFactory, the database schema will be dropped.
  • validate - The database schema will be validated using the entity mappings.
  • update - The database schema will be updated by comparing the existing database schema with the entity mappings.

I dedicated a blog post for the most common Hibernate DDL generation strategies:

  1. The"update" is convenient but less flexible if you plan on adding functions or executing some custom scripts.
  2. The most flexible approach is to use Flyway.

However, even if you use Flyway, you can still generate the initial migration script using hbm2ddl. In this article, you can see how you can combine the JPA Entity Model with jOOQ Table Model.