Generate DDL with spring boot using a custom delimiter

前端 未结 5 1847
臣服心动
臣服心动 2020-12-31 20:27

I want generate create and drop ddl scripts using spring boot v1.4.3 with JPA - Hibernate 5.0.11.

Most answers I found use the javax.persistence.schema-generati

5条回答
  •  长发绾君心
    2020-12-31 21:00

    You might want to try setting the following Hibernate property:

    spring.jpa.properties.hibernate.hbm2ddl.delimiter=;
    
    #in addition to the other standard JPA properties you refered to, namely:
    spring.jpa.properties.javax.persistence.schema-generation.scripts.action=create
    spring.jpa.properties.javax.persistence.schema-generation.scripts.create-target=create.sql
    

    I found this to do the job in a Spring Boot 2.1.2.RELEASE + matching Hibernate version (5.3.7.Final) project where I needed the same feature.

    It might very well work on your not-so-different Hibernate environment.


    Slightly off-topic, but one issue I have remains: Hibernate appends to create.sql. I whish I found a way to have it replace the file contents.

提交回复
热议问题