File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
spring-orm/src/main/java/org/springframework/orm/jpa/vendor Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -362,15 +362,25 @@ public void resetSessionState() {
362362 }
363363 if (this .preparedCon != null && this .session .isConnected ()) {
364364 Connection conToReset = HibernateConnectionHandle .doGetConnection (this .session );
365- if (conToReset != this . preparedCon ) {
365+ if (! isEquivalentConnection ( conToReset ) ) {
366366 LogFactory .getLog (HibernateJpaDialect .class ).warn (
367- "JDBC Connection to reset not identical to originally prepared Connection - please " +
367+ "JDBC Connection to reset not equivalent to originally prepared Connection - please " +
368368 "make sure to use connection release mode ON_CLOSE (the default) and to run against " +
369369 "Hibernate 4.2+ (or switch HibernateJpaDialect's prepareConnection flag to false" );
370370 }
371371 DataSourceUtils .resetConnectionAfterTransaction (conToReset , this .previousIsolationLevel );
372372 }
373373 }
374+
375+ private boolean isEquivalentConnection (Connection con ) {
376+ try {
377+ return (con .equals (this .preparedCon ) ||
378+ con .unwrap (Connection .class ).equals (this .preparedCon .unwrap (Connection .class )));
379+ }
380+ catch (Throwable ex ) {
381+ return false ;
382+ }
383+ }
374384 }
375385
376386
You can’t perform that action at this time.
0 commit comments