sqlMapClient.startTransaction() - cases

868 views Asked by At

Is it possible to use sqlMapClient.startTransaction(); and sqlMapClient.commitTransaction(); in the case of Select statements?

I have given start and commit transaction for insert , update and select statement and somewhere I am getting an error.

MySQLNonTransientConnectionException: No operations allowed after connection closed.Connection was implicitly closed due to underlying exception/error:

All connection started and closed. and given for each start transactions. Nothing has added in catch block.

 finally {
     sqlMapClient.endTransaction();
 }

I guess there is no need of using start /commit transaction for select statements. Can anyone please clarify it?

1

There are 1 answers

1
user1484819 On BEST ANSWER

The error just indicates that the connection already closed, you may missed some exception/errors.

To answer your question, select of course can be in a transaction.