【发布时间】:2014-06-21 14:40:17
【问题描述】:
我正在尝试设置 Hibernate Envers 以使用我的 Spring Boot 应用程序。
我已经包含了 Envers 依赖项并添加了 @Audited 注释,它工作正常,但我无法配置特定的 Envers 属性,Spring Boot 似乎没有选择它们。
具体来说,我尝试通过将审计表放入 application.properties 来为审计表设置不同的数据库架构,但没有运气:
hibernate.envers.default_schema=app_audit
或
org.hibernate.envers.default_schema=app_audit
或
spring.jpa.hibernate.envers.default_schema=app_audit
这些都不起作用。有谁知道如何设置这些?
编辑。
正如 M. Deinum 建议的那样,我尝试过:
spring.jpa.properties.org.hibernate.envers.default_schema=app_audit
它成功了!
【问题讨论】:
-
前缀为
spring.jpa.properties。试试spring.jpa.properties.hibernate.envers.default_schema=app_audit。另请参阅Spring Boot reference guide。 -
我把它变成了一个答案,请接受(如果你愿意,可以投票)。
-
你是如何设法创建 envers 表的?
-
嗯,我设置了 spring.jpa.hibernate.hbm2ddl.auto=create-drop。所以每次hibernate都会自动创建我的表。
-
@Milan 把你的答案放在答案部分,我在回答你的问题后找到了你的答案:)
标签: spring hibernate jpa spring-boot hibernate-envers