hibernate.hbm2ddl.auto


hibernate.hbm2ddl.auto
create | update | validate | create-drop

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.


  1. In case of update, if schema is not present in the DB then the schema is created.
  2. In case of validate, if schema does not exists in DB, it is not created.
  3. Instead, it will throw an error:- Table not found:<table name>
  4. In case of create-drop, schema is not dropped on closing the session. It drops only on closing the SessionFactory.
  5. 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 behavior:
  6. -If schema is not present in the DB:- It creates the schema

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