1 16 package com.ibatis.sqlmap.engine.transaction.user; 17 18 import com.ibatis.common.jdbc.logging.ConnectionLogProxy; 19 import com.ibatis.common.logging.Log; 20 import com.ibatis.common.logging.LogFactory; 21 import com.ibatis.sqlmap.engine.transaction.Transaction; 22 import com.ibatis.sqlmap.engine.transaction.TransactionException; 23 24 import java.sql.Connection ; 25 import java.sql.SQLException ; 26 27 public class UserProvidedTransaction implements Transaction { 28 29 private static final Log connectionLog = LogFactory.getLog(Connection .class); 30 31 private Connection connection; 32 33 public UserProvidedTransaction(Connection connection) { 34 if (connectionLog.isDebugEnabled()) { 35 this.connection = ConnectionLogProxy.newInstance(connection); 36 } else { 37 this.connection = connection; 38 } 39 } 40 41 public void commit() throws SQLException , TransactionException { 42 connection.commit(); 43 } 44 45 public void rollback() throws SQLException , TransactionException { 46 connection.rollback(); 47 } 48 49 public void close() throws SQLException , TransactionException { 50 connection.close(); 51 } 52 53 public Connection getConnection() throws SQLException , TransactionException { 54 return connection; 55 } 56 57 } 58 | Popular Tags |