1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.mybatis.spring;
17
18 import static org.springframework.util.Assert.notNull;
19
20 import org.apache.ibatis.session.ExecutorType;
21 import org.apache.ibatis.session.SqlSession;
22 import org.springframework.dao.support.PersistenceExceptionTranslator;
23 import org.springframework.transaction.support.ResourceHolderSupport;
24
25
26
27
28
29
30
31
32
33 public final class SqlSessionHolder extends ResourceHolderSupport {
34
35 private final SqlSession sqlSession;
36
37 private final ExecutorType executorType;
38
39 private final PersistenceExceptionTranslator exceptionTranslator;
40
41
42
43
44
45
46
47
48
49
50
51 public SqlSessionHolder(SqlSession sqlSession, ExecutorType executorType,
52 PersistenceExceptionTranslator exceptionTranslator) {
53
54 notNull(sqlSession, "SqlSession must not be null");
55 notNull(executorType, "ExecutorType must not be null");
56
57 this.sqlSession = sqlSession;
58 this.executorType = executorType;
59 this.exceptionTranslator = exceptionTranslator;
60 }
61
62 public SqlSession getSqlSession() {
63 return sqlSession;
64 }
65
66 public ExecutorType getExecutorType() {
67 return executorType;
68 }
69
70 public PersistenceExceptionTranslator getPersistenceExceptionTranslator() {
71 return exceptionTranslator;
72 }
73
74 }