Hibernate.hbm2ddl.auto
hibernate.hbm2ddl.auto is automatically validates and exports DDL to schema when the sessionFactory is created.
By default, It is not doing any creation or modification automatically on db. If user sets below values then it is doing DDL schema changes automatically.
create - doing creating schema
update - updating existing schema
validate - validate existing schema
create-drop - create and drop the schema automatically when session is starts and ends.
|
How to use hibernate.hbm2ddl.auto property
# validate
<entry key="hibernate.hbm2ddl.auto" value="validate" />
# update
<entry key="hibernate.hbm2ddl.auto" value="update" />
# create
<entry key="hibernate.hbm2ddl.auto" value="create" />
# create-drop
<entry key="hibernate.hbm2ddl.auto" value="create-drop" />
|