Description
In the doSelect(), doDelete(), doInsert(), and doUpdate() methods in BasePeer a database connection is obtained, some work performed, and then, if successful, the work is committed and the database connection is closed. If a TorqueException is thrown while performing the work, the work is rolled back and the database connection is closed. If a RuntimeException is thrown while performing the work, the work is not rolled back and the database connection remains open.
The fix is simple: catch Exception (or Throwable) instead of TorqueException. This will ensure that, no matter what the problem is, Torque ensures the database connection is closed.