Hibernate prepareConnection and close mode after_transaction

We have updated our application to Spring 4.3.14.RELEASE and Hibernate 4.3.11.Final. We have been using connection release mode AFTER_TRANSACTION and there seem to be an issue with that:

WARN JDBC Connection to reset not identical to originally prepared Connection - please make sure to use connection release mode ON_CLOSE (the default) and to run against Hibernate 4.2+ (or switch HibernateJpaDialect’s prepareConnection flag to false

We cannot just change the option to ON_CLOSE as our application expects this release mode. Is the AFTER_TRANSACTION release mode still supported? The warning also mentions setting the prepareConnection flag to false, but I couldn’t find what this flag actually does and what is the property key to actually set it. I don’t want to get to some other unexpected behaviour because of setting it.

With update I also started seeing this:

GooGooStatementCache:441 - Multiply prepared statement!

Is it something to do with the previous warning?

We cannot just change the option to ON_CLOSE as our application expects this release mode

You don’t really need to change the connection release mode. AFTER_STATEMENT is the default for Hibernate 5 anyway.

The warning also mentions setting the prepareConnection flag to false, but I couldn’t find what this flag actually does and what is the property key to actually set it. I don’t want to get to some other unexpected behaviour because of setting it.

That warning you’re seeing does not come from Hibernate, but from Spring. So, you should ask the Spring team about it since that’s their code base.

With update I also started seeing this:

Again, thata’s not coming from Hibernate, so check the JDBC Driver or where that message originates from.