org.mybatis.spring.support
Class SqlSessionDaoSupport
java.lang.Object
org.springframework.dao.support.DaoSupport
org.mybatis.spring.support.SqlSessionDaoSupport
- All Implemented Interfaces:
- org.springframework.beans.factory.InitializingBean
- Direct Known Subclasses:
- MapperFactoryBean
public abstract class SqlSessionDaoSupport
- extends org.springframework.dao.support.DaoSupport
Convenient super class for MyBatis SqlSession data access objects.
It gives you access to the template which can then be used to execute SQL methods.
This class needs a SqlSessionTemplate or a SqlSessionFactory.
If both are set the SqlSessionFactory will be ignored.
{code Autowired} was removed from setSqlSessionTemplate and setSqlSessionFactory
in version 1.2.0.
- Version:
- $Id$
- See Also:
setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory)
,
setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate)
,
SqlSessionTemplate
Fields inherited from class org.springframework.dao.support.DaoSupport |
logger |
Methods inherited from class org.springframework.dao.support.DaoSupport |
afterPropertiesSet, initDao |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SqlSessionDaoSupport
public SqlSessionDaoSupport()
setSqlSessionFactory
public void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
setSqlSessionTemplate
public void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)
getSqlSession
public org.apache.ibatis.session.SqlSession getSqlSession()
- Users should use this method to get a SqlSession to call its statement methods
This is SqlSession is managed by spring. Users should not commit/rollback/close it
because it will be automatically done.
- Returns:
- Spring managed thread safe SqlSession
checkDaoConfig
protected void checkDaoConfig()
-
- Specified by:
checkDaoConfig
in class org.springframework.dao.support.DaoSupport
Copyright © 2010-2013 MyBatis.org. All Rights Reserved.