Hibernate hbm2ddl.auto, possible values, and what they do

随声附和 提交于 2019-11-27 12:19:06

The link you provided is already the official documentation. So, there's nothing more official and comprehensive as-of today.

So I guess the answer to your question is two-fold:

I know this isn't the perfect answer you dreamt about, but this is actually all you have today.

But the good news is that the project is open-source, so you have all you need to help improve it :-).

wahid_cse

For hbm2ddl.auto property the list of possible options is:

  • validate: validate that the schema matches, make no changes to the schema of the database, you probably want this for production.
  • update: update the schema to reflect the entities being persisted
  • create: creates the schema necessary for your entities, destroying any previous data.
  • create-drop: create the schema as in create above, but also drop the schema at the end of the session. This is great in early development or for testing.
Joel Harris

The documentation has been updated to include this information. Here is a link to the official, current documentation for this feature.

hibernate.hbm2ddl.auto (e.g. none (default value), create-only, drop, create, create-drop, validate, and update)

Setting to perform SchemaManagementTool actions automatically as part of the SessionFactory lifecycle. Valid options are defined by the externalHbm2ddlName value of the Action enum:

none
    No action will be performed.

create-only
    Database creation will be generated.

drop
    Database dropping will be generated.

create
    Database dropping will be generated followed by database creation.

create-drop
    Drop the schema and recreate it on SessionFactory startup. Additionally, drop the schema on SessionFactory shutdown.

validate
    Validate the database schema

update
    Update the database schema
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!