-
1. Re: Audit Tables Referential Integrity
adamw Mar 2, 2009 8:35 AM (in response to ido.ran)Hello,
Envers uses option 2. If you modify a field in an entity, only that entity will be persisted, and no other referenced entities. With option 1, the size of the database would easily explode :).
There is one small exception. If you have a bi-directional relation, and a certain configuration option isn't set to "false", if for example you add a new element to the collection, or remove an element, a revision for the other side will be generated also.
So if you update the name of the customer, the "order" table should have a revision generated only if the order has a collection of related customers and the equals() in the customer depends on the name. That is quite logical - in such circumstances, the value of the field in "order" that corresponds to customer changes.
But as I said, you can switch it off - look in the docs for more details.
--
Adam