We're updating the issue view to help you get more done. 

Multiple revisions are created during a single transaction with FlushMode COMMIT

Description

When the FlushMode is set to commit, a manual flush during a transaction leads to multiple audit revision to be created.

Consider the following example:

1 2 3 4 5 6 7 EntityManager em = getEntityManager(); em.getTransaction().begin(); int revisionNumber = getAuditReader().getCurrentRevision( SequenceIdRevisionEntity.class, true ).getId(); em.flush(); StrTestEntity entity = new StrTestEntity( "entity" ); em.persist( entity ); em.getTransaction().commit();

In the example the persisted entity should have the same revision number ass the revision number obtained before the flush. However, the entity will be assigned to a new revision number.

It seems that the AuditProcess does check for FlushMode COMMIT instead of FlushMode MANUAL. This has been introduced with 5.2.

Environment

None

Status

Assignee

Chris Cranford

Reporter

Felix Feisst

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Worked in

5.1.5

Components

Affects versions

5.2.0

Priority

Major