1 16 package com.ibatis.db.dao.jdbc; 17 18 import com.ibatis.db.dao.DaoException; 19 import com.ibatis.db.dao.DaoTransaction; 20 import com.ibatis.sqlmap.client.SqlMapClient; 21 22 import java.sql.SQLException ; 23 24 public class SqlMap2DaoTransaction implements DaoTransaction { 25 26 27 private SqlMapClient client; 28 29 public SqlMap2DaoTransaction(SqlMapClient sqlMap) { 30 this.client = sqlMap; 31 } 32 33 public void commit() throws DaoException { 34 try { 35 client.commitTransaction(); 36 client.endTransaction(); 37 } catch (SQLException e) { 38 throw new DaoException("Error committing transaction. Cause: " + e, e); 39 } 40 } 41 42 public void rollback() throws DaoException { 43 try { 44 client.endTransaction(); 45 } catch (SQLException e) { 46 throw new DaoException("Error rolling back transaction. Cause: " + e, e); 47 } 48 } 49 50 public void release() throws DaoException { 51 } 53 54 public SqlMapClient getSqlMapClient() { 55 return client; 56 } 57 58 } 59 | Popular Tags |