Envers does not work in case of resource-local transactions and manual session flush mode

Description

When I set a manual hibernate session flush mode envers does not write data in database. With FlushMode.AUTO all works ok. I think the problem in in a method doBeforeTransactionCompletion of the AuditProcess.java:

if (FlushMode.isManualFlushMode(session.getFlushMode())) {
Session temporarySession = null;
try {
temporarySession = session.getFactory().openTemporarySession();

executeInSession(temporarySession);

temporarySession.flush();
} finally {
if (temporarySession != null) {
temporarySession.close();
}
}
} else {
executeInSession((Session) session);

// Explicity flushing the session, as the auto-flush may have already happened.
session.flush();
}

In non-jta environment temporary session connection transaction is not commited.

Environment

Hibernate 3.6.9, MySQL 5.1.44-community, mysql-connector-java-5.1.6, Inno DB tables

Status

Assignee

Lukasz Antoniak

Reporter

Vladimir Velikiy

Fix versions

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.6.9

Priority

Major
Configure