Is it so necessary to permit only positive revision numbers?

Description

Is it so necessary to permit only positive revision numbers?

Some methods nicely works with revisions having any number (forRevisionsOfEntity) and some (e.g. AuditReader.find) mandate a revision number to be positive). Which value this check brings? If I have to introduce Envers to the existing application I would like to fill in newly created auditing tables with the current state of the "operational" tables and revision number 0 (or even -1) to clearly distinguish it from "normal" revisions.

Environment

None

Activity

Show:
Gail Badner
August 16, 2011, 2:56 AM

Adam, please assign as appropriate.
Thanks,
Gail

Chris Cranford
January 19, 2017, 2:50 AM

The reason that forRevisionsOfEntity do not impose a positive number check unlike the other exposed find methods is because the user isn't asked to provide a revision number for that query signature.

The revision number sequence Envers uses is designed to start at 1 and increment by 1 for each revision generated in the system, hence the reason the data check exists where applicable for user input arguments.

A more appropriate solution would be to leverage the fact you can supply Envers with a custom annotated @RevisionEntity entity where you could add a specify a flag to indicate whether the revision was a migration revision or not. This avoids tainting the revision number with some magic value as well as potentially exposing a forward compatibility concern with future changes.

Assignee

Chris Cranford

Reporter

Oleksandr Alesinskyy

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure