Hibernate 5. Generate SQL DDL into file

前端 未结 4 2142
执念已碎
执念已碎 2021-02-06 10:07

I tried using this class:

Hibernate/JPA: Check generated sql before updating DB Schema (like .NET EF migrations)

I have the following code:

pack         


        
4条回答
  •  半阙折子戏
    2021-02-06 10:52

    Normally tools that dumps the JPA schema are based on SchemaExport tool, which reads only the static metadata.

    There is a Maven/Gradle plugin https://github.com/Devskiller/jpa2ddl which generates the JPA schema. In includes all properties, namings strategies, user types, etc.

    You can also use it to generate automated schema migrations for Flyway.

提交回复
热议问题