File tree Expand file tree Collapse file tree 1 file changed +4
-23
lines changed
src/main/java/org/mybatis/spring/support Expand file tree Collapse file tree 1 file changed +4
-23
lines changed Original file line number Diff line number Diff line change 22
22
import org .springframework .util .Assert ;
23
23
24
24
/**
25
- * Convenient super class for MyBatis SqlSession data access objects. In the usual case, all that a
26
- * DAO needs is an SqlSessionFactory. This class also supports passing in an SqlSessionTemplate if a
27
- * custom DataSource or ExceptionTranslator is needed for a specific DAO.
25
+ * Convenient super class for MyBatis SqlSession data access objects.
26
+ * It gives you access to the template which can then be used to execute SQL methods.
28
27
* <p>
29
- *
30
- * By default, each DAO gets its own SqlSessionTemplate which holds the SqlSessionFactory.
31
- * SqlSessionTemplate is thread safe, so a single instance can be shared by all DAOs; there
32
- * should also be a small memory savings by doing this. To support a shared template, this class has
33
- * a constructor that accepts an SqlSessionTemplate. This pattern can be used in Spring
34
- * configuration files as follows:
35
- *
36
- * <pre class="code">
37
- * {@code
38
- * <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
39
- * <property name="sqlSessionFactory" ref="sqlSessionFactory" />
40
- * </bean>
41
- *
42
- * <bean id="baseDAO" abstract="true" lazy-init="true">
43
- * <property name="sqlSessionTemplate" ref="sqlSessionTemplate" />
44
- * </bean>
45
- *
46
- * <bean id="testDao" parent="baseDAO" class="org.mybatis.spring.support.SqlSessionDaoSupport" />
47
- * }
48
- * </pre>
28
+ * This class needs a SqlSessionTemplate or a SqlSessionFactory.
29
+ * If both are set the SqlSessionFactory will be ignored.
49
30
*
50
31
* @see #setSqlSessionFactory
51
32
* @see #setSqlSessionTemplate
You can’t perform that action at this time.
0 commit comments