From e71762a313a71bba7c06e51c4c8694a2c79ed12b Mon Sep 17 00:00:00 2001 From: adamw Date: Thu, 31 Mar 2011 15:50:28 +0200 Subject: [PATCH] HHH-6036: Adding a basics chapter to introduce Envers concepts --- .../main/docbook/devguide/en-US/Envers.xml | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/documentation/src/main/docbook/devguide/en-US/Envers.xml b/documentation/src/main/docbook/devguide/en-US/Envers.xml index 03156d5011..39de7c795d 100644 --- a/documentation/src/main/docbook/devguide/en-US/Envers.xml +++ b/documentation/src/main/docbook/devguide/en-US/Envers.xml @@ -20,6 +20,36 @@ +
+ Basics + + + To audit changes that are performed on an entity, you only need two things: the + hibernate-envers jar on the classpath and an @Audited annotation + on the entity. + + + + And that's all - you can create, modify and delete the entites as always. If you look at the generated + schema for your entities, or at the data persisted by Hibernate, you will notice that there are no changes. + However, for each audited entity, a new table is introduced - entity_table_AUD, + which stores the historical data, whenever you commit a transaction. + + + + Instead of annotating the whole class and auditing all properties, you can annotate + only some persistent properties with @Audited. This will cause only + these properties to be audited. + + + + The audit (history) of an entity can be accessed using the AuditReader interface, which + can be obtained having an open EntityManager or Session via + the AuditReaderFactory. See the javadocs for these classes for details on the + functionality offered. + +
+
Configuration