sqlMapClient.startTransaction() - 个案

sqlMapClient.startTransaction() - cases

是否可以在 Select 语句的情况下使用 sqlMapClient.startTransaction();sqlMapClient.commitTransaction();

我已经为插入、更新和 select 语句提供了启动和提交事务,但在某处出现错误。

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();
 }

我想 select 语句不需要使用启动/提交事务。谁能解释一下?

该错误只是表明连接已经关闭,您可能错过了一些exception/errors。

回答你的问题,select当然可以在交易中。