File tree 1 file changed +12
-2
lines changed
spring-orm/src/main/java/org/springframework/orm/jpa/vendor
1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -362,15 +362,25 @@ public void resetSessionState() {
362
362
}
363
363
if (this .preparedCon != null && this .session .isConnected ()) {
364
364
Connection conToReset = HibernateConnectionHandle .doGetConnection (this .session );
365
- if (conToReset != this . preparedCon ) {
365
+ if (! isEquivalentConnection ( conToReset ) ) {
366
366
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 " +
368
368
"make sure to use connection release mode ON_CLOSE (the default) and to run against " +
369
369
"Hibernate 4.2+ (or switch HibernateJpaDialect's prepareConnection flag to false" );
370
370
}
371
371
DataSourceUtils .resetConnectionAfterTransaction (conToReset , this .previousIsolationLevel );
372
372
}
373
373
}
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
+ }
374
384
}
375
385
376
386
You can’t perform that action at this time.
0 commit comments