A revision number identifies a transaction-sized audit change set. Envers assigns sequential numbers as audited entities are created, modified, or deleted; higher numbers represent newer entity versions. section 13.3 section 13.3.3
Use revision numbers to:
- Resolve a change set from a timestamp with AuditReader. section 13.3.3
- List every revision involving a particular audited entity instance. section 13.3.3
- Load an entity as it existed at a selected revision, or query historical entities at that revision. section 13.3.4
Item history
A transaction creates an Item named “Foo” and its User seller, a later transaction changes them to “Bar” and “doejohn,” and a final transaction deletes the Item. Envers records three change sets. Loading the Item at the creation revision returns “Foo”; loading it at the update revision returns “Bar”; loading it at the deletion revision returns null. The historical User remains available. section 13.3.2
Revision metadata is stored with a timestamp in REVINFO; audit tables link entity snapshots through the revision number and record whether each change inserted, updated, or deleted data. Historical entities returned by AuditReader are detached or read-only, so modifying them does not update the database. section 13.3.1 section 13.3.4
