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?
You don't have to enable automatic DDL creation in order to use Envers.
You can simply create the schema yourself. Basically each audited table gets a mirror table with an _AUD suffix, plus the revision columns.
Schema generation is available via the schemaexport ant task, see here: http://docs.jboss.org/hibernate/core/4.1/devguide/en-US/html/ch15.html#envers-generateschema
Also, you can simply generate the DDL on a local database and use it as a reference to apply to other databases.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With