Index: src/main/groovy/sql/Sql.java
===================================================================
--- src/main/groovy/sql/Sql.java	(revision 15923)
+++ src/main/groovy/sql/Sql.java	Tue Apr 07 22:02:12 EST 2009
@@ -1556,6 +1556,31 @@
     }
 
     /**
+     * Performs the closure within a transaction using a cached connection.
+     *
+     * @param closure the given closure
+     * @throws SQLException if a database error occurs
+     */
+    public synchronized void withTransaction(Closure closure) throws SQLException {
+        cacheConnection = true;
+        Connection connection = null;
+        try {
+            connection = createConnection();
+            connection.setAutoCommit(false);
+            closure.call();
+            connection.commit();
+        } catch (SQLException e) {
+            log.log(Level.INFO, "Rolling back due to exception: " + e, e);
+            if (connection != null) connection.rollback();
+            throw e;
+        } finally {
+            if (connection != null) connection.setAutoCommit(true);
+            cacheConnection = false;
+            closeResources(connection, null);
+        }
+    }
+
+    /**
      * Caches every created preparedStatement in closure <i>closure</i></br>
      * Every cached preparedStatement is closed after closure has been called.
      *

