15
15
*/
16
16
package org .mybatis .spring ;
17
17
18
+ import static org .mybatis .spring .SqlSessionUtils .closeSqlSession ;
19
+ import static org .mybatis .spring .SqlSessionUtils .getSqlSession ;
20
+ import static org .mybatis .spring .SqlSessionUtils .isSqlSessionTransactional ;
18
21
import static org .springframework .util .Assert .notNull ;
19
22
20
23
import java .lang .reflect .InvocationHandler ;
35
38
import org .apache .ibatis .session .SqlSessionFactory ;
36
39
import org .springframework .dao .support .PersistenceExceptionTranslator ;
37
40
41
+
38
42
/**
39
43
* Thread safe, Spring managed, {@code SqlSession} that works with Spring
40
44
* transaction management to ensure that that the actual SqlSession used is the
@@ -343,13 +347,13 @@ public List<BatchResult> flushStatements() {
343
347
*/
344
348
private class SqlSessionInterceptor implements InvocationHandler {
345
349
public Object invoke (Object proxy , Method method , Object [] args ) throws Throwable {
346
- final SqlSession sqlSession = SqlSessionUtils . getSqlSession (
350
+ final SqlSession sqlSession = getSqlSession (
347
351
SqlSessionTemplate .this .sqlSessionFactory ,
348
352
SqlSessionTemplate .this .executorType ,
349
353
SqlSessionTemplate .this .exceptionTranslator );
350
354
try {
351
355
Object result = method .invoke (sqlSession , args );
352
- if (!SqlSessionUtils . isSqlSessionTransactional (sqlSession , SqlSessionTemplate .this .sqlSessionFactory )) {
356
+ if (!isSqlSessionTransactional (sqlSession , SqlSessionTemplate .this .sqlSessionFactory )) {
353
357
// force commit even on non-dirty sessions because some databases require
354
358
// a commit/rollback before calling close()
355
359
sqlSession .commit (true );
@@ -365,7 +369,7 @@ public Object invoke(Object proxy, Method method, Object[] args) throws Throwabl
365
369
}
366
370
throw unwrapped ;
367
371
} finally {
368
- SqlSessionUtils . closeSqlSession (sqlSession , SqlSessionTemplate .this .sqlSessionFactory );
372
+ closeSqlSession (sqlSession , SqlSessionTemplate .this .sqlSessionFactory );
369
373
}
370
374
}
371
375
}
0 commit comments