Can any one suggest a solution to this problem. We are using Hibernate 3.0 as persistance framework. While searching records from DB(oracle) we are using native Sql. For that we are getting hibernate session using openSession() method and we are fetching the records. We are not beggning any transaction and commiting transaction. So when ever we are searching a record we are getting below exception in log.
E J2CA0081E: Method cleanup failed while trying to execute method cleanup on ManagedConnection
com.ibm.ws.rsadapter.spi.WSRdbManagedConnectionImpl@6fecd6a7 from resource jdbc/TMTPDataSource. Caught exception:com.ibm.ws.exception.WsException:
DSRA0080E: An exception was received by the Data Store Adapter. See original exception message: Cannot call 'cleanup' on a ManagedConnection while it is still in a transaction..
when I search in some fourms I found that when we featch records using hibernate even non transactional queries should be inside transaction. For examples: Select queries also we need to keep inside a transaction. The logic behind this is when ever we open a session by default hibernate will set autoCommit as false. So even read only transactions should also keep inside begin and commit of transaction.
We missed this logic and we written the code. We are closing the session in each and every place inside finally block. Still the connection is not releasing because of the above exception. Now the code is in production. We cannot go and change the code to keep transactionn begin and commit inside each select as we need to change in so many places and we need to test again.
Please suggest a way so that we should not get this exception in the production and connection should be releasing to pool if we say session.close().
While I can't help you with the question, I'm pretty confident that the answer won't have much to do with JDBC. I've moved it to the ORM forum, where questions related to Hibernate have better chance of being answered.