|
Till now, we have analyzed that in org.hibernate.engine.jdbc.internal.JdbcCoordinatorImpl.java inside afterStatementExecution() method, the call to hasRegisteredResources() returns false for hibernate version (4.2.1 to 4.2.16) hence getLogicalConnection().releaseConnection() is getting called which in turns call connection.close() making dataSource reference null for the wrapped connection object. This is not the case with hibernate versions 4.1.6 to 4.2.0 where hasRegisteredResources() always returns true for Query.list()/ Iterator.next(). Refer Null-DataSouce.png where dataSource is null after last call of Iterator.next().
|