目前,我正在使用默认的@SpringBootApplication
注释和以下属性在application.properties
中:
spring.datasource.url=jdbc:mysql://localhost/dbname
spring.datasource.username=X
spring.datasource.password=X
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.hibernate.naming_strategy=my.package.CustomNamingStrategy
自从JPA 2.1以来,我应该能够使用javax.persistence.schema-generation.*
属性,但将它们设置在我的application.properties中似乎没有任何效果。
我看到过像这样的示例,它连接了一堆额外的bean,但它们没有使用Mysql。而且无论如何,像那样做都需要我配置许多Spring现在正在为我处理的选项。
我的目标是:
- 生成一个MYSQL方言的模式创建SQL脚本
- 不需要数据库连接
- 输出脚本到构建目录
- 同样生成hibernate envers表将是一个巨大的加分点。
我不想:
- 在实时数据库上创建/删除模式
Lib版本:
hibernate : 4.3.11.FINAL
spring framework : 4.2.5.RELEASE
spring-boot : 1.3.3.RELEASE
spring-data-jpa : 1.10.1.RELEASE // for querydsl 4 support
spring-data-commons: 1.12.1.RELEASE // for querydsl 4 support
(使用Gradle,而不是Maven)