After upgrade from Hibernate 5.1.0 releate to 5.2.4 there is error with JTA Transactions with Spring and Envers audited JPA entities.
Session is closed before AuditProces insert revision data. Spring JtaTransactionManager closed it in commit() and nested synchronization releaseResource() method.
Before Hibernate 5.2.0 session was not closed when in active transaction.
In attachment is unit test (JtaTransactionWithSpringReleaseResource.java) for Envers where entityManager.close() method is invoked in transaction. In 5.1.x codebase is running without errors.
Complete runable maven project with configured Spring, Hibernate, JTA and unit test is in another attachment.
Thank you for quick response.