对ibatis封装

public class PermanenceSQLMapper {
	private SqlMapClient sqlMapper = null;
	
	public PermanenceSQLMapper() {
		sqlMapper = SQLMapClient.getSqlMaper();
	}
	
	//插入
	public Object insert(String id, Object parameterObject) throws SQLException {
		return sqlMapper.insert(id, parameterObject);
	}
	
	//查询多行
	public List queryForList(String id, Object parameterObject) throws SQLException {
		return sqlMapper.queryForList(id, parameterObject);
	}
	
	//查询单行
	public Object queryForObject(String id, Object parameterObject) throws SQLException {
		return sqlMapper.queryForObject(id, parameterObject);
	}
	
	//更新
	public int update(String id, Object parameterObject) throws SQLException {
		return sqlMapper.update(id, parameterObject);
	}
	
	//删除
	public int delete(String id, Object parameterObject) throws SQLException {
		return sqlMapper.delete(id, parameterObject);
	}
	
	//开启事务
	public void openTransaction() throws SQLException {
		sqlMapper.startTransaction();
	}
	
	//提交事务
	public void commintTransaction() throws SQLException {
		sqlMapper.commitTransaction();
	}
	
	//结束事务,事务没有完成  回滚
	public void endTransaction() throws SQLException {
		sqlMapper.endTransaction();
	}
}

你可能感兴趣的:(ibatis)