Thanks for the reply but it does not work better without the close() call
If i remove the close()
The connection is not realase in the connectionPool, it remain in inUse state
i checked the AvailableConnectionCount in ManagedConnectionPool Mbean and it decrease by one each time a call my code.
Here is hibenate log with connection.close() call
2006-03-28 23:39:26,625 DEBUG [org.hibernate.jdbc.JDBCContext] opening user JDBC connection, application must close it
2006-03-28 23:39:26,707 DEBUG [org.hibernate.jdbc.JDBCContext] before transaction completion
2006-03-28 23:39:26,707 DEBUG [org.hibernate.impl.SessionImpl] before transaction completion
2006-03-28 23:39:26,740 WARN [org.jboss.tm.TransactionImpl] XAException: tx=TransactionImpl:XidImpl[FormatId=257, GlobalId=zorglub/33, BranchQual=, localId=33] errorCode=XA_UNKNOWN(0)
org.jboss.resource.connectionmanager.JBossLocalXAException: could not commit local tx; - nested throwable: (org.jboss.resource.JBossResourceException: SQLException; - nested throwable: (org.postgresql.util.PSQLException: Connection is closed. Operation is not permitted.))
at org.jboss.resource.connectionmanager.TxConnectionManager$LocalXAResource.commit(TxConnectionManager.java:947)
And the log without close()
2006-03-28 23:22:49,603 DEBUG [org.hibernate.jdbc.JDBCContext] opening user JDBC connection, application must close it
2006-03-28 23:22:49,677 DEBUG [org.hibernate.jdbc.JDBCContext] before transaction completion
2006-03-28 23:22:49,677 DEBUG [org.hibernate.impl.SessionImpl] before transaction completion
2006-03-28 23:22:49,678 DEBUG [org.hibernate.transaction.CacheSynchronization] transaction after completion callback, status: 3
2006-03-28 23:22:49,678 DEBUG [org.hibernate.jdbc.JDBCContext] after transaction completion
2006-03-28 23:22:49,678 DEBUG [org.hibernate.impl.SessionImpl] after transaction completion
2006-03-28 23:22:49,678 DEBUG [org.hibernate.transaction.CacheSynchronization] automatically closing session
2006-03-28 23:22:49,678 DEBUG [org.hibernate.impl.SessionImpl] automatically closing session
2006-03-28 23:22:49,678 DEBUG [org.hibernate.impl.SessionImpl] closing session
2006-03-28 23:22:49,678 DEBUG [org.hibernate.jdbc.ConnectionManager] connection already null in cleanup : no action
2006-03-28 23:22:49,678 DEBUG [org.hibernate.impl.SessionImpl] closing session
2006-03-28 23:22:49,678 DEBUG [org.hibernate.jdbc.ConnectionManager] connection already null in cleanup : no action
2006-03-28 23:23:20,548 DEBUG [org.hibernate.jdbc.ConnectionManager] running Session.finalize()
If i well understand what happened i should call the ConnectionProvider.closeConnection(cnx) instead of cnx.close()
But i see no way to get a ref to the connectionProvider instance from the Hibernate session instance
Thanks in advance for your help
|