【发布时间】:2016-08-26 06:25:27
【问题描述】:
目前,我在application.properties 中使用具有以下属性的默认@SpringBootApplication 注释:
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 中设置它们似乎没有任何效果。
我见过like this 连接一大堆额外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)
【问题讨论】:
标签: hibernate spring-boot spring-data spring-data-jpa