Skip to content

JDBC Connection to reset not identical to originally prepared Connection with Hibernate 5.2 [SPR-14393] #18966

Closed
@spring-projects-issues

Description

@spring-projects-issues

Koen van Dijk opened SPR-14393 and commented

This issue occured after updating my application to the latest versions of spring, spring data and hibernate (from 4.3.9.Final to 5.2.0.Final, 4.2.2.Release to 4.3.0.Release, 1.9.1.RELEASE to 1.10.2.Release)

I noticed that a warning started to appear in my logs. " WARN org.springframework.orm.jpa.vendor.HibernateJpaDialect (HibernateJpaDialect.java:366) qtp883841715-95 :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"

I found this warning quite worrisome since it indicated a fairly serious bug in my application if it were true that the connection that initiated the transaction was not the same as the one that ended it. After some digging I found that the connections were in fact equal and that this warning was caused by the fact that Hikari uses proxy objects to wrap the connections. Hikari did manage to wrap the same connection but it uses a different wrapper object during the beginning and ending of the transaction.

The piece of code in the class org.springframework.orm.jpa.vendor.HibernateJpaDialect of particular interest is:

if (conToReset != this.preparedCon)
 {
	LogFactory.getLog(HibernateJpaDialect.class).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");
}

I have the following question:
I am under the impression that in this case I am safely able to ignore this warning since it is only the proxy object that differs and not the actual jdbc connection, do you share my conclusion?


Affects: 4.3 GA

Reference URL: https://github.com/brettwooldridge/HikariCP

Issue Links:

Referenced from: commits 5e08598, 351a729, 711eb99

0 votes, 6 watchers

Metadata

Metadata

Assignees

Labels

in: dataIssues in data modules (jdbc, orm, oxm, tx)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions