From 70f53da5da607b00621bd2bd006b69c6568576fc Mon Sep 17 00:00:00 2001 From: mstanleyjones Date: Wed, 13 Oct 2010 14:27:28 +1000 Subject: [PATCH] Edited Envers chapter --- .../docbook/en-US/content/tutorial_envers.xml | 115 +++++++++++------- .../docbook/en-US/content/tutorial_jpa.xml | 17 +-- 2 files changed, 72 insertions(+), 60 deletions(-) diff --git a/documentation/quickstart/src/main/docbook/en-US/content/tutorial_envers.xml b/documentation/quickstart/src/main/docbook/en-US/content/tutorial_envers.xml index ee840940b7..6c7c6b3ead 100644 --- a/documentation/quickstart/src/main/docbook/en-US/content/tutorial_envers.xml +++ b/documentation/quickstart/src/main/docbook/en-US/content/tutorial_envers.xml @@ -5,50 +5,51 @@ Tutorial Using Envers - This tutorial is located within the download bundle under envers and illustrates - - - - configuring Envers - - - - - using the Envers APIs to look back through history - - - + This tutorial is located within the download bundle under envers. + + Objectives + + + Configure Envers. + + + + + Use the Envers APIs to view and analyze historical data. + + +
- <filename>persistence.xml</filename> - - This file was discussed in the JPA tutorial, and is largely the same here. The major - difference is the set of properties defining listeners. - Essentially this enables Envers to recieve notfications from Hibernate processing of certain - events such as an entity being saved or updated. - + <filename>persistence.xml</filename> + + This file was discussed in the JPA tutorial in , and is largely the same here. The major difference is the set + of properties defining listeners. Listeners enable Envers to receive notfications from + Hibernate processing about events such as saving or updating of entities. +
- The annotated entity Java class - - Again, the entity is largely the same as seen in the JPA tutorial. The major - difference to notice is the addition of the @org.hibernate.envers.Audited - annotation which tells Envers to automatically track changes to this entity. - + The annotated entity Java class + + Again, the entity is largely the same as in . The major + difference is the addition of the @org.hibernate.envers.Audited annotation, which + tells Envers to automatically track changes to this entity. +
- Example code - - Again, this tutorial makes use of the JPA APIs. However, the code also makes a - change to one of the entites and then uses the Envers API to pull back the initial revision (version) - as well as the updated revision. - - - Using the <interfacename>org.hibernate.envers.AuditReader</interfacename> - public void testBasicUsage() { + Example code + + Again, this tutorial makes use of the JPA APIs. However, the code also makes a change to one + of the entites, then uses the Envers API to pull back the initial revision as well as the updated + revision. A revision refers to a version of an entity. + + + Using the <interfacename>org.hibernate.envers.AuditReader</interfacename> + public void testBasicUsage() { ... AuditReader reader = AuditReaderFactory.get( entityManager ); Event firstRevision = reader.find( Event.class, 2L, 1 ); @@ -56,17 +57,41 @@ Event secondRevision = reader.find( Event.class, 2L, 2 ); ... } - - - First an org.hibernate.envers.AuditReader is obtained - from the org.hibernate.envers.AuditReaderFactory wrapping the + + + Description of Example + + + An org.hibernate.envers.AuditReader is obtained from the + org.hibernate.envers.AuditReaderFactory which wraps the javax.persistence.EntityManager. - - - Then the find method is used to retrieve specific revisions of the entity. The - first call reads "find revision number 1 of Event with id 2". The second call reads "find revision - number 2 of Event with id 2". - + + + + + Next,the find method retrieves specific revisions of the entity. The first call + reads find revision number 1 of Event with id 2. The second call reads find + revision number 2 of Event with id 2. + + + +
+ +
+ Take it further! + + Practice Exercises + + + + + + + + + + +
\ No newline at end of file diff --git a/documentation/quickstart/src/main/docbook/en-US/content/tutorial_jpa.xml b/documentation/quickstart/src/main/docbook/en-US/content/tutorial_jpa.xml index 4148c0175f..ae1d08a958 100644 --- a/documentation/quickstart/src/main/docbook/en-US/content/tutorial_jpa.xml +++ b/documentation/quickstart/src/main/docbook/en-US/content/tutorial_jpa.xml @@ -127,18 +127,5 @@ entityManager.close();]]>
Take it further! - Practice Exercises - - - - - - - - - - - -
- - \ No newline at end of file + Practice Exercises + \ No newline at end of file