Skip to content

Commit bd80f71

Browse files
committed
imported SqlSessionUtils static methods
1 parent 0d02206 commit bd80f71

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/main/java/org/mybatis/spring/SqlSessionTemplate.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package org.mybatis.spring;
1717

18+
import static org.mybatis.spring.SqlSessionUtils.closeSqlSession;
19+
import static org.mybatis.spring.SqlSessionUtils.getSqlSession;
20+
import static org.mybatis.spring.SqlSessionUtils.isSqlSessionTransactional;
1821
import static org.springframework.util.Assert.notNull;
1922

2023
import java.lang.reflect.InvocationHandler;
@@ -35,6 +38,7 @@
3538
import org.apache.ibatis.session.SqlSessionFactory;
3639
import org.springframework.dao.support.PersistenceExceptionTranslator;
3740

41+
3842
/**
3943
* Thread safe, Spring managed, {@code SqlSession} that works with Spring
4044
* transaction management to ensure that that the actual SqlSession used is the
@@ -343,13 +347,13 @@ public List<BatchResult> flushStatements() {
343347
*/
344348
private class SqlSessionInterceptor implements InvocationHandler {
345349
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
346-
final SqlSession sqlSession = SqlSessionUtils.getSqlSession(
350+
final SqlSession sqlSession = getSqlSession(
347351
SqlSessionTemplate.this.sqlSessionFactory,
348352
SqlSessionTemplate.this.executorType,
349353
SqlSessionTemplate.this.exceptionTranslator);
350354
try {
351355
Object result = method.invoke(sqlSession, args);
352-
if (!SqlSessionUtils.isSqlSessionTransactional(sqlSession, SqlSessionTemplate.this.sqlSessionFactory)) {
356+
if (!isSqlSessionTransactional(sqlSession, SqlSessionTemplate.this.sqlSessionFactory)) {
353357
// force commit even on non-dirty sessions because some databases require
354358
// a commit/rollback before calling close()
355359
sqlSession.commit(true);
@@ -365,7 +369,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
365369
}
366370
throw unwrapped;
367371
} finally {
368-
SqlSessionUtils.closeSqlSession(sqlSession, SqlSessionTemplate.this.sqlSessionFactory);
372+
closeSqlSession(sqlSession, SqlSessionTemplate.this.sqlSessionFactory);
369373
}
370374
}
371375
}

0 commit comments

Comments
 (0)