liveBook · Manning

Revision number

As explained in Java Persistence with Spring Data and Hibernate epub

A revision number is a sequential identifier assigned to an audited change set, with higher numbers representing more recent revisions.

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

How Java Persistence with Spring Data and Hibernate epub covers it

How deep it goes
Explains sequencing, timestamps, audit tables, change types, and detached historical results, but defers custom tracking strategies.
Examples
Demonstrates Item and User creation, modification, deletion, timestamp lookup, revision enumeration, and historical loading.
What it assumes
Assumes familiarity with EntityManager transactions, audited entities, and basic Hibernate Envers usage.
What you can do after
Operate/configure Envers to find revisions and inspect audited entity states at selected points in history.
How it connects
Connects revision numbers with audit logging, transactions, historical data, entity versioning, and Hibernate Envers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Java Persistence with Spring Data and Hibernate epub. The section links point to the parts of the book it draws on.