Force Hibernate To Create Tables After Dropping and Recreating database

前端 未结 2 667
-上瘾入骨i
-上瘾入骨i 2021-01-18 18:03

I am developing a web application with java 2 ee. I also use hibernate and mysql. in order to restore the backup file, in some point in my application i need to drop the cur

2条回答
  •  遥遥无期
    2021-01-18 18:12

    You need to add the following property to your configuration:

    Drop and Recreate everytime SessionFactory is created and destroyed:

    create-drop
    

    Other possible options:

    • validate: validate the schema, makes no changes to the database.
    • update: update the schema.
    • create: creates the schema, destroying previous data.

提交回复
热议问题