简体   繁体   中英

How does Hibernate Envers work?

I am using Hibernate envers in one of my projects. It works really good and does that job.

I am trying to understand the internal working mechanism of envers.

  1. How does envers work internally?

  2. What happens when the actual transaction is succeeded and the audit table update fails? Will the entire transaction be rolled back?

  3. Does envers be executed in a different thread than the actual one serving the request? or can it be?

Hibernate Envers provides a very simple solution for CDC (Change Data Capture) .

  1. It uses the Hibernate Event system to intercept all entity state transitions and audit them.
  2. The database transaction will roll back and both the actual changes and the audit log is rolled back.
  3. No. Envers is a synchronous audit logging mechanism. For asynchronous audit logging, you need to use Debezium .

If you want to use Envers, make sure you are using the validity audit strategy because it performs better than the default one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM