To get the current rev number (for the current tx), you have to persist the revision entity, as that's when the DB assigns the revision number.
If you want to know the latest rev number excluding the current tx, just do: select max(re.id) from DefaultRevisionEntity re
final AuditReader reader = AuditReaderFactory.get(entityManager);
final Number revision = reader.getRevisionNumberForDate(new Date(Long.MAX_VALUE));
final Date revisionDate = reader.getRevisionDate(revision);
The behaviour I see is that:
creates a new revision (with the ID accessible with Number n = revisionEntity.getId();).
However when the current transaction has been committed the actual revision on the relevant update rows in the *_AUD table(s) is > n (n + 1 when no other updates to the database overlap this tx).
So the Id on the returned object from 'getCurrentRevision' isn't the one applied when the current Tx is committed.
For reference, the environment: Hibernate Envers 4.2, Spring 3.2 @Transactional annotated transactions; DB2 9.1.
I've also posted this on SO as a longer question: