1

Envers expects one audit table for each auditable table in the system. So if I want to audit 30 table, I must have 30 audit tables. From Can i use only one table for all hibernate envers auditing? and from the docs, this seems to be the only option available.

I would like to know why this decision was made instead of having only one table with metadata that stores the entire audit information, or why this option was not provided:

1- Is that a question of performance?

2- Is there some scenario that cannot be covered having only one table for all audit info?

3- It was just the easiest way to implement it?

4- Other?

Community
  • 1
  • 1
VitorCruz
  • 372
  • 2
  • 17

1 Answers1

2

Two main reasons I think:

  • I wanted the audit tables to have a clear, human-browsable representation. While it is possible to understand and query the audit tables that Envers generates directly from SQL, it would be much harder for a human to comprehend a single table with data from all other tables.

  • a single table could become very large quickly, making it harder to manage audits of individual entities. With separate entities, the situation is clear

Apart from that, I think both solutions might be good, but in the end you have to settle on one.

It would be possible to implement Envers's functionality using a single table (a different audit strategy), but nobody did it yet.

adamw
  • 8,038
  • 4
  • 28
  • 32
  • About the second point, you mean harder to manage it in order to keep performance? Or programatically difficult to fetch the information? Could you pls elaborate more, perhaps with an example? – VitorCruz May 26 '14 at 20:10
  • Manage from a DB point of view - sometimes the audits get large only for some tables, and you may want e.g. to truncate the history after some time, or move to an external storage. – adamw May 27 '14 at 07:22