Description
Affects: 3.1.4.RELEASE
Using hibernate: 3.6.10.Final
I'm facing an issue caused by opening connections with database on session.close call.
For some reason, hibernate throws an exception when is opening a connection with database, then he starts to rollback the transaction.
From now on, a proxy connection exists in session (TransactionAwareInvocationHandler
), but real connection with database does not exists.
After that, spring-orm call SessionFactoryUtils.closeSession
, and this goes to close connection, but real connection failed to be created
Hibernate ConnectionManager
, before close the connection call JDBCExceptionReporter.logAndClearWarnings( connection );
(connection parameter is proxy TransactionAwareInvocationHandler
connection without real connection because creation failed)
Then TransactionAwareInvocationHandler
create a new connection with database because getWarnings
and clearWarnings
are not mapped methods in invoke
This connection is closed right after creation, but when I am inside a transaction, this connection resource is binded to thread and never unbinded. Because spring-tx is alredy in a rollback block.
I think a connection should not be opened when some of those two methods getWarnings
and clearWarnings
are called and real connection does not exists.