https://bytefish.de/blog/hibernate_envers_versioning_and_auditing/
isCommitStateDirty == false
isAutoCommit == true
leakTask.isLeaked = true
leakTask.exception = "java.lang.Exception: Apparent connection leak detected"
[2017-10-25 23:20:33.364] [] [BlackBox] [DB_POOL housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool@logPoolState:389 - DB_POOL - Pool stats (total=2, active=1, idle=1, waiting=0)
23:20:33.366 [http-apr-8080-exec-8] ERROR org.hibernate.AssertionFailure - HHH000099: an assertion failure occurred (this may indicate a bug in Hibernate, but is more likely due to unsafe use of the session): java.lang.RuntimeException: Cannot update previous revision for entity org.magic.model.reference.Reference_history and id 250
[2017-10-25 23:21:03.365] [] [BlackBox] [DB_POOL housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool@logPoolState:389 - DB_POOL - Pool stats (total=2, active=0, idle=2, waiting=0)
config.setDriverClassName(_env.getProperty("db.driver")); // com.mysql.cj.jdbc.Driver
config.setJdbcUrl(_env.getProperty("db.url")); // jdbc:mysql://localhost:3306/app?autoReconnect=true&useSSL=false&noAccessToProcedureBodies=true&serverTimezone=UTC
config.setUsername(_env.getProperty("db.user"));
config.setPassword(_env.getProperty("db.pass"));
config.setMaximumPoolSize(_env.getProperty("hikari.pool.max.size", Integer.class)); // 2 for local
config.setConnectionTestQuery("SELECT 1");
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
config.addDataSourceProperty("elideSetAutoCommits", "true");
config.addDataSourceProperty("maintainTimeStats", "false");
config.addDataSourceProperty("cacheServerConfiguration", "true");
config.addDataSourceProperty("cacheResultSetMetadata", "true");
config.setLeakDetectionThreshold(FIVE_SECONDS);The line of code in envar that you referenced is checking three conditions. I assume that the exception is thrown because rowCount != 1, have you verified that? It might provide a clue.
Also, it looks like ReturningWork.execute() receives a Connection object, can you verify if it is the same one that was committed? If you breakpoint there and inspect the Connection, what does its state look like?