Skip to content

Commit

Permalink
* 发布3.4.4 版本
Browse files Browse the repository at this point in the history
  • Loading branch information
fjn committed Jan 19, 2021
1 parent 97a6b40 commit 13682f3
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package com.jn.sqlhelper.mybatis.spring.session.factory.dynamicdatasource;

import com.jn.langx.annotation.NonNull;
import com.jn.langx.util.Preconditions;
import com.jn.langx.util.collection.Collects;
import com.jn.langx.util.function.Consumer2;
import com.jn.langx.util.reflect.Reflects;
Expand Down Expand Up @@ -125,7 +126,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
DynamicSqlSessionFactory dynamicSqlSessionFactory = DynamicSqlSessionTemplate.this.getDynamicSqlSessionFactory();
@NonNull
DataSourceKey key = MethodInvocationDataSourceKeySelector.getCurrent();

Preconditions.checkNotNull(key, "the selected datasource key is null");
DelegatingSqlSessionFactory sqlSessionFactory = dynamicSqlSessionFactory.getDelegatingSqlSessionFactory();
ExecutorType executorType = sqlSessionFactory.getConfiguration().getDefaultExecutorType();
PersistenceExceptionTranslator exceptionTranslator = sqlSessionFactory.getPersistenceExceptionTranslator();
Expand All @@ -147,7 +148,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
sqlSession = getSqlSession(sqlSessionFactory, executorType, exceptionTranslator);

// 当改调用发生在sqlhelper transaction manager 范围内时,需要注册
if (key != null && transaction != null) {
if (transaction != null) {
TransactionThreadContext.bindTransactionResource(key, new SqlSessionTransactionalResource(Reflects.getMethodString(method), sqlSession, sqlSessionFactory));
}
}
Expand Down

0 comments on commit 13682f3

Please sign in to comment.