Hibernate/JPA DB Schema Generation Best Practices

前端 未结 5 794
梦毁少年i
梦毁少年i 2020-11-29 01:34

I just wanted to hear the opinion of Hibernate experts about DB schema generation best practices for Hibernate/JPA based projects. Especially:

  1. What strategy

5条回答
  •  春和景丽
    2020-11-29 02:07

    Although disputable, I'd say that the answer to all 3 questions is: let hibernate automatically generate the tables in the schema.

    I haven't had any problems with that so far. You might need to clean some field up manually from time to time, but this is no headache compared to separately keeping track of DDL scripts - i.e. managing their revisions and synchronizing them with entity changes (and vice-versa)

    For deploying on production - an obvious tip - first make sure everything is generated OK on the test environment and then deploy on production.

提交回复
热议问题