/*
* Copyright 2004 Clinton Begin
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ibatis.sqlmap.engine.impl;
import com.ibatis.common.util.PaginatedList;
import com.ibatis.common.logging.Log;
import com.ibatis.common.logging.LogFactory;
import com.ibatis.sqlmap.client.*;
import com.ibatis.sqlmap.client.event.RowHandler;
import com.ibatis.sqlmap.engine.execution.BatchException;
import com.ibatis.sqlmap.engine.execution.SqlExecutor;
import com.ibatis.sqlmap.engine.mapping.result.ResultObjectFactory;
import com.ibatis.sqlmap.engine.mapping.statement.MappedStatement;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;
import java.util.Map;
/**
* Implementation of ExtendedSqlMapClient
*/
//澶栭儴SqlMapClient鐨勫疄鐜扮被锛屼篃鏄竴涓腑闂寸被锛屽叿浣撴搷浣滆浆鍖栧埌SqlMapSessionImpl瀹炰緥鍖栧璞″幓
public class SqlMapClientImpl implements SqlMapClient, ExtendedSqlMapClient {
private static final Log log = LogFactory.getLog(SqlMapClientImpl.class);
/**
* Delegate for SQL execution
*/
public SqlMapExecutorDelegate delegate;
protected ThreadLocal localSqlMapSession = new ThreadLocal();//澶勭悊绾跨▼瀹夊叏鐨勫綋鍓嶇嚎绋嬬粍
/**
* Constructor to supply a delegate
*
* @param delegate - the delegate
*/
public SqlMapClientImpl(SqlMapExecutorDelegate delegate) {
this.delegate = delegate;
}
public Object insert(String id, Object param) throws SQLException {
return getLocalSqlMapSession().insert(id, param);
}
public Object insert(String id) throws SQLException {
return getLocalSqlMapSession().insert(id);
}
public int update(String id, Object param) throws SQLException {
return getLocalSqlMapSession().update(id, param);
}
public int update(String id) throws SQLException {
return getLocalSqlMapSession().update(id);
}
public int delete(String id, Object param) throws SQLException {
return getLocalSqlMapSession().delete(id, param);
}
public int delete(String id) throws SQLException {
return getLocalSqlMapSession().delete(id);
}
public Object queryForObject(String id, Object paramObject) throws SQLException {
return getLocalSqlMapSession().queryForObject(id, paramObject);
}
public Object queryForObject(String id) throws SQLException {
return getLocalSqlMapSession().queryForObject(id);
}
public Object queryForObject(String id, Object paramObject, Object resultObject) throws SQLException {
return getLocalSqlMapSession().queryForObject(id, paramObject, resultObject);
}
public List queryForList(String id, Object paramObject) throws SQLException {
return getLocalSqlMapSession().queryForList(id, paramObject);
}
public List queryForList(String id) throws SQLException {
return getLocalSqlMapSession().queryForList(id);
}
public List queryForList(String id, Object paramObject, int skip, int max) throws SQLException {
return getLocalSqlMapSession().queryForList(id, paramObject, skip, max);
}
public List queryForList(String id, int skip, int max) throws SQLException {
return getLocalSqlMapSession().queryForList(id, skip, max);
}
/**
* @deprecated All paginated list features have been deprecated
*/
public PaginatedList queryForPaginatedList(String id, Object paramObject, int pageSize) throws SQLException {
return getLocalSqlMapSession().queryForPaginatedList(id, paramObject, pageSize);
}
/**
* @deprecated All paginated list features have been deprecated
*/
public PaginatedList queryForPaginatedList(String id, int pageSize) throws SQLException {
return getLocalSqlMapSession().queryForPaginatedList(id, pageSize);
}
public Map queryForMap(String id, Object paramObject, String keyProp) throws SQLException {
return getLocalSqlMapSession().queryForMap(id, paramObject, keyProp);
}
public Map queryForMap(String id, Object paramObject, String keyProp, String valueProp) throws SQLException {
return getLocalSqlMapSession().queryForMap(id, paramObject, keyProp, valueProp);
}
public void queryWithRowHandler(String id, Object paramObject, RowHandler rowHandler) throws SQLException {
getLocalSqlMapSession().queryWithRowHandler(id, paramObject, rowHandler);
}
public void queryWithRowHandler(String id, RowHandler rowHandler) throws SQLException {
getLocalSqlMapSession().queryWithRowHandler(id, rowHandler);
}
public void startTransaction() throws SQLException {
getLocalSqlMapSession().startTransaction();
}
public void startTransaction(int transactionIsolation) throws SQLException {
getLocalSqlMapSession().startTransaction(transactionIsolation);
}
public void commitTransaction() throws SQLException {
getLocalSqlMapSession().commitTransaction();
}
public void endTransaction() throws SQLException {
try {
getLocalSqlMapSession().endTransaction();
} finally {
getLocalSqlMapSession().close();
}
}
public void startBatch() throws SQLException {
getLocalSqlMapSession().startBatch();
}
public int executeBatch() throws SQLException {
return getLocalSqlMapSession().executeBatch();
}
public List executeBatchDetailed() throws SQLException, BatchException {
return getLocalSqlMapSession().executeBatchDetailed();
}
public void setUserConnection(Connection connection) throws SQLException {
try {
getLocalSqlMapSession().setUserConnection(connection);
} finally {
if (connection == null) {
getLocalSqlMapSession().close();
}
}
}
/**
* TODO Deprecated
*
* @return Current connection
* @throws SQLException
* @deprecated
*/
public Connection getUserConnection() throws SQLException {
return getCurrentConnection();
}
public Connection getCurrentConnection() throws SQLException {
return getLocalSqlMapSession().getCurrentConnection();
}
public DataSource getDataSource() {
return delegate.getDataSource();
}
public MappedStatement getMappedStatement(String id) {
return delegate.getMappedStatement(id);
}
public boolean isLazyLoadingEnabled() {
return delegate.isLazyLoadingEnabled();
}
public boolean isEnhancementEnabled() {
return delegate.isEnhancementEnabled();
}
public SqlExecutor getSqlExecutor() {
return delegate.getSqlExecutor();
}
public SqlMapExecutorDelegate getDelegate() {
return delegate;
}
public SqlMapSession openSession() {
SqlMapSessionImpl sqlMapSession = new SqlMapSessionImpl(this);
sqlMapSession.open();
return sqlMapSession;
}
public SqlMapSession openSession(Connection conn) {
try {
SqlMapSessionImpl sqlMapSession = new SqlMapSessionImpl(this);
sqlMapSession.open();
sqlMapSession.setUserConnection(conn);
return sqlMapSession;
} catch (SQLException e) {
throw new SqlMapException("Error setting user provided connection. Cause: " + e, e);
}
}
/**
* TODO : DEPRECATED
*
* @deprecated Use openSession()
*/
public SqlMapSession getSession() {
log.warn("Use of a deprecated API detected. SqlMapClient.getSession() is deprecated. Use SqlMapClient.openSession() instead.");
return openSession();
}
public void flushDataCache() {
delegate.flushDataCache();
}
public void flushDataCache(String cacheId) {
delegate.flushDataCache(cacheId);
}
//閲囩敤鍗曚緥妯″紡锛屽疄鐜扮嚎绋嬬殑瀹夊叏鎬�
protected SqlMapSessionImpl getLocalSqlMapSession() {
SqlMapSessionImpl sqlMapSession = (SqlMapSessionImpl) localSqlMapSession.get();
if (sqlMapSession == null || sqlMapSession.isClosed()) {
sqlMapSession = new SqlMapSessionImpl(this);
localSqlMapSession.set(sqlMapSession);
}
return sqlMapSession;
}
public ResultObjectFactory getResultObjectFactory() {
return delegate.getResultObjectFactory();
}
}
分享到:
相关推荐
1. **SqlMapClient接口简介:** SqlMapClient是iBatis的核心接口,它的实现类是SqlMapClientImpl。SqlMapClient负责执行SQL映射工作,包括SELECT、INSERT、UPDATE、DELETE等操作。 2. **SqlMapClient接口方法:** ...
实际应用中,通常会通过`SqlMapClientImpl`类来实现这些功能。`SqlMapSession`是每个数据库会话的表示,可以共享或独立创建,但使用完毕后需调用关闭接口释放资源。 `SqlMapExecutorDelegate`是执行代理类,它是...
该接口的实现类是`SqlMapClientImpl`。 - **queryForList**:用于执行查询操作并将结果封装为`List`对象返回。支持多种重载方法,包括指定参数、限制结果集大小等。 - `queryForList(String id)`:执行指定ID的...
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
前端分析-2023071100789
基于kinect的3D人体建模C++完整代码.cpp
搞机工具箱10.1.0.7z
GRU+informer时间序列预测(Python完整源码和数据),python代码,pytorch架构,适合各种时间序列直接预测。 适合小白,注释清楚,都能看懂。功能如下: 代码基于数据集划分为训练集测试集。 1.多变量输入,单变量输出/可改多输出 2.多时间步预测,单时间步预测 3.评价指标:R方 RMSE MAE MAPE,对比图 4.数据从excel/csv文件中读取,直接替换即可。 5.结果保存到文本中,可以后续处理。 代码带数据,注释清晰,直接一键运行即可,适合新手小白。
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
基于ANSYS LSDyna的DEM-SPH-FEM耦合模拟滑坡入水动态行为研究,基于ANSYS LSDyna的DEM-SPH-FEM耦合的滑坡入水模拟分析研究,基于ansys lsdyna的滑坡入水模拟dem-sph-fem耦合 ,基于ANSYS LSDyna; 滑坡入水模拟; DEM-SPH-FEM 耦合,基于DEM-SPH-FEM耦合的ANSYS LSDyna滑坡入水模拟
auto_gptq-0.6.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
复件 复件 建设工程可行性研究合同[示范文本].doc
13考试真题最近的t64.txt
好用我已经解决报错问题
# 踏入C语言的奇妙编程世界 在编程的广阔宇宙中,C语言宛如一颗璀璨恒星,以其独特魅力与强大功能,始终占据着不可替代的地位。无论你是编程小白,还是有一定基础想进一步提升的开发者,C语言都值得深入探索。 C语言的高效性与可移植性令人瞩目。它能直接操控硬件,执行速度快,是系统软件、嵌入式开发的首选。同时,代码可在不同操作系统和硬件平台间轻松移植,极大节省开发成本。 学习C语言,能让你深入理解计算机底层原理,培养逻辑思维和问题解决能力。掌握C语言后,再学习其他编程语言也会事半功倍。 现在,让我们一起开启C语言学习之旅。这里有丰富教程、实用案例、详细代码解析,助你逐步掌握C语言核心知识和编程技巧。别再犹豫,加入我们,在C语言的海洋中尽情遨游,挖掘无限可能,为未来的编程之路打下坚实基础!
auto_gptq-0.4.2-cp38-cp38-win_amd64.whl
自动立体库设计方案.pptx
# 踏入C语言的奇妙编程世界 在编程的广阔宇宙中,C语言宛如一颗璀璨恒星,以其独特魅力与强大功能,始终占据着不可替代的地位。无论你是编程小白,还是有一定基础想进一步提升的开发者,C语言都值得深入探索。 C语言的高效性与可移植性令人瞩目。它能直接操控硬件,执行速度快,是系统软件、嵌入式开发的首选。同时,代码可在不同操作系统和硬件平台间轻松移植,极大节省开发成本。 学习C语言,能让你深入理解计算机底层原理,培养逻辑思维和问题解决能力。掌握C语言后,再学习其他编程语言也会事半功倍。 现在,让我们一起开启C语言学习之旅。这里有丰富教程、实用案例、详细代码解析,助你逐步掌握C语言核心知识和编程技巧。别再犹豫,加入我们,在C语言的海洋中尽情遨游,挖掘无限可能,为未来的编程之路打下坚实基础!
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!
在日常的工作和学习中,你是否常常为处理复杂的数据、生成高质量的文本或者进行精准的图像识别而烦恼?DeepSeek 或许就是你一直在寻找的解决方案!它以其高效、智能的特点,在各个行业都展现出了巨大的应用价值。然而,想要充分发挥 DeepSeek 的优势,掌握从入门到精通的知识和技能至关重要。本文将从实际应用的角度出发,为你详细介绍 DeepSeek 的基本原理、操作方法以及高级技巧。通过系统的学习,你将能够轻松地运用 DeepSeek 解决实际问题,提升工作效率和质量,让自己在职场和学术领域脱颖而出。现在,就让我们一起开启这场实用又高效的学习之旅吧!