当前位置: 首页>>代码示例>>Java>>正文


Java SimpleExecutor类代码示例

本文整理汇总了Java中org.apache.ibatis.executor.SimpleExecutor的典型用法代码示例。如果您正苦于以下问题:Java SimpleExecutor类的具体用法?Java SimpleExecutor怎么用?Java SimpleExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SimpleExecutor类属于org.apache.ibatis.executor包,在下文中一共展示了SimpleExecutor类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getObject

import org.apache.ibatis.executor.SimpleExecutor; //导入依赖的package包/类
@Override
public SqlSessionFactory getObject() throws Exception {
    SqlSessionFactory sqlSessionFactory = super.getObject();
    if (sqlSessionFactory instanceof DefaultSqlSessionFactory)
        return proxy(sqlSessionFactory, methodInvocation -> {
            if (methodInvocation.getMethod().getName().equals("openSession")) {
                SqlSession session = (SqlSession) methodInvocation.proceed();
                if (session instanceof DefaultSqlSession) {
                    DefaultSqlSession defaultSqlSession = (DefaultSqlSession) session;
                    Executor executor = (Executor) ReflectionUtils.getFieldValue(defaultSqlSession, "executor");
                    if (executor instanceof CachingExecutor) {
                        CachingExecutor cachingExecutor = (CachingExecutor) executor;
                        SimpleExecutor ex = (SimpleExecutor) ReflectionUtils.getFieldValue(cachingExecutor, "delegate");
                        System.out.println("ex-> " + ex.getClass().getName());
                        ReflectionUtils.setDeclaredFieldValue(cachingExecutor, "delegate", proxy(ex, invocation -> {
                            System.out.println("method->" + invocation.getMethod());
                            return invocation.proceed();
                        }));
                    }
                }
                return session;
            }
            return methodInvocation.proceed();
        });
    return sqlSessionFactory;
}
 
开发者ID:maniaclee,项目名称:shardy,代码行数:27,代码来源:ShardSqlSessionFactoryBean.java

示例2: session

import org.apache.ibatis.executor.SimpleExecutor; //导入依赖的package包/类
public SqlSession session(Connection conn) {

		Transaction transaction = new ManagedTransaction(conn, false);
		SimpleExecutor excutor = new SimpleExecutor(configuration, transaction);
		return new DefaultSqlSession(configuration, excutor);
	}
 
开发者ID:youtongluan,项目名称:sumk,代码行数:7,代码来源:SqlSessionFactory.java

示例3: getSqlSession

import org.apache.ibatis.executor.SimpleExecutor; //导入依赖的package包/类
public SqlSession getSqlSession(Connection conn) throws SQLException {
	ManagedTransaction transaction = new ManagedTransaction(conn, false);
	SimpleExecutor excutor = new SimpleExecutor(configuration, transaction);
	return new DefaultSqlSessionHelper(configuration, excutor);
}
 
开发者ID:nince-wyj,项目名称:jahhan,代码行数:6,代码来源:DBSessionHelper.java


注:本文中的org.apache.ibatis.executor.SimpleExecutor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。