Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can i use only one table for all hibernate envers auditing?

i recently found the beautiful library that is called "hibernate envers", it's such a great and easy way to have an audit log, it solved one of my biggest problem while working on a play web-application. Now, i know that Envers use one table for each audited entity, and want to know if it is possible to have one table for every thing? (using a varchar to put all the data for example and put the entity model in a separate column)

Thanks in advance.

like image 996
etshei Avatar asked Apr 10 '13 11:04

etshei


People also ask

How does Hibernate Envers work?

Hibernate Envers provides a very simple solution for CDC (Change Data Capture). It uses the Hibernate Event system to intercept all entity state transitions and audit them. The database transaction will roll back and both the actual changes and the audit log is rolled back.

What is Revinfo table?

REVINFO. This table stores the revision information. By default, Hibernate persists only the revision number as an integer and the creation timestamp as a long.

What is audited in Hibernate?

auditing of Hibernate mappings, which extend JPA, like custom types and collections/maps of "simple" types (Strings, Integers, etc.) (see also Chapter 9, Mapping exceptions) logging data for each revision using a "revision entity" querying historical data.


1 Answers

No, that is not possible. Only table-per-entity strategies are available currently (Default and ValidityAuditStrategy).

See the manual: http://docs.jboss.org/hibernate/core/4.1/devguide/en-US/html/ch15.html

like image 98
adamw Avatar answered Sep 18 '22 23:09

adamw