From e72fa13bd49598b791184eb56f301a281600a438 Mon Sep 17 00:00:00 2001 From: adamw Date: Thu, 31 Mar 2011 14:16:13 +0200 Subject: [PATCH] HHH-6036: Some corrections to the "revision log" chapter of Envers docs --- .../main/docbook/devguide/en-US/Envers.xml | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/documentation/src/main/docbook/devguide/en-US/Envers.xml b/documentation/src/main/docbook/devguide/en-US/Envers.xml index 4f03965677..293217c8d0 100644 --- a/documentation/src/main/docbook/devguide/en-US/Envers.xml +++ b/documentation/src/main/docbook/devguide/en-US/Envers.xml @@ -263,22 +263,21 @@ - - revision number - An integral value (int/Integer or - long/Long). Essentially the primary key of the revision - - - revision timestamp - either a long/Long or - java.util.Date value representing the instant at which the revision was made. - When using a java.util.Date, instead of a long/Long for - the revision timestamp, take care not to store it to a column data type which will loose precision. - + revision number - An integral value (int/Integer or + long/Long). Essentially the primary key of the revision + + + revision timestamp - either a long/Long or + java.util.Date value representing the instant at which the revision was made. + When using a java.util.Date, instead of a long/Long for + the revision timestamp, take care not to store it to a column data type which will loose precision. Envers handles this information as an entity. By default it uses its own internal class to act as the - entity. You can, however, supply your own approach to collecting this information which might be useful to + entity, mapped to the REVINFO table. + You can, however, supply your own approach to collecting this information which might be useful to capture additional details such as who made a change or the ip address from which the request came. There are 2 things you need to make this work. @@ -331,9 +330,9 @@ public class MyCustomRevisionListener implements RevisionListener { is to instead call the getCurrentRevision method of the org.hibernate.envers.AuditReader interface to obtain the current revision, and fill it with desired information. The method accepts a persist parameter indicating - whether the revision entity should be persisted prior to returning from this method. true - which will ensure the returned entity has access to its identifier value (revision number), but the revision - entity will be persisted regardless of whether there are any audited entities changed. false + whether the revision entity should be persisted prior to returning from this method. true + ensures that the returned entity has access to its identifier value (revision number), but the revision + entity will be persisted regardless of whether there are any audited entities changed. false means that the revision number will be null, but the revision entity will be persisted only if some audited entities have changed. @@ -343,7 +342,9 @@ public class MyCustomRevisionListener implements RevisionListener { Example of storing username with revision - ExampleRevEntity.javaExampleRevEntity.java - ExampleListener.javaExampleListener.java