Spring boot ddl auto generator

前端 未结 2 1039
长情又很酷
长情又很酷 2020-12-14 14:18

I\'m using spring boot with spring.jpa.hibernate.ddl-auto=create, but when application restarted, all tables drops and creates again. Is there some way to avoid

相关标签:
2条回答
  • 2020-12-14 14:55

    The list of option which is used in the spring boot are

    • validate: validate the schema, makes no changes to the database.
    • update: update the schema.
    • create: creates the schema, destroying previous data.
    • create-drop: drop the schema at the end of the session
    • none: is all other cases.

    So for avoiding the data lose you use update

    0 讨论(0)
  • 2020-12-14 15:14
    spring.jpa.hibernate.ddl-auto=update
    

    hibernate.ddl-auto should usually not be used in production.

    0 讨论(0)
提交回复
热议问题