2

I am using Spring + MySQL and Hibernate in my application. I wanted to start using Envers as an audit log, but as I understand, in order to use it I must enable Hibernate to create DDL.

Is there a way to use Envers without letting Hibernate create DDL, or even better, create DDL only for Envers tables?

If not, is there a way to tell Hibernate to export the DDL to a file instead of the DB so I can take only what I need?

4

1 回答 1

4

您无需启用自动 DDL 创建即可使用 Envers。

您可以简单地自己创建架构。基本上每个被审计的表都有一个带有 _AUD 后缀的镜像表,以及修订列。

可以通过 schemaexport ant 任务生成模式,请参见此处:http ://docs.jboss.org/hibernate/core/4.1/devguide/en-US/html/ch15.html#envers-generateschema

此外,您可以简单地在本地数据库上生成 DDL,并将其用作引用以应用于其他数据库。

于 2013-05-29T19:53:03.470 回答