本文整理汇总了Java中org.apache.ibatis.executor.CachingExecutor类的典型用法代码示例。如果您正苦于以下问题:Java CachingExecutor类的具体用法?Java CachingExecutor怎么用?Java CachingExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CachingExecutor类属于org.apache.ibatis.executor包,在下文中一共展示了CachingExecutor类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getObject
import org.apache.ibatis.executor.CachingExecutor; //导入依赖的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: intercept
import org.apache.ibatis.executor.CachingExecutor; //导入依赖的package包/类
@Override
public Object intercept(Invocation invocation) throws Throwable {
CachingExecutor executor = (CachingExecutor) invocation.getTarget();
return null;
}
开发者ID:beihaifeiwu,项目名称:dolphin,代码行数:6,代码来源:BatchInterceptor.java
注:本文中的org.apache.ibatis.executor.CachingExecutor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论