Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create envers audit table at different database and preferrably logging done in a different transaction

Hibernate envers creates the audit tables in the same database ,I needed to use other database at a different location to create and maintain these audit tables (preferrable not in the same transaction). As per my understanding the logging is done in the same transaction as that of the audited domain table updation or insertion etc. I know that logically it has been taken care of in envers that if the audit fails the transaction should rollback , but in my case it does not matter if the logging fails for some of the items. It would be just fine even if it is the same transaction but the audit table location is the separate database. Please Suggest me how to do that or if it is possible at all. Thanks in advance

like image 855
sHIELD Avatar asked Dec 08 '25 07:12

sHIELD


1 Answers

As described here, you can use a different schema/catalog:

The default schema name that should be used for audit tables. Can be overridden using the @AuditTable(schema="...") annotation. If not present, the schema will be the same as the schema of the table being audited.

like image 59
Dherik Avatar answered Dec 11 '25 10:12

Dherik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!