org.mybatis.spring.support
Class SqlSessionDaoSupport

java.lang.Object
  extended by org.springframework.dao.support.DaoSupport
      extended by 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.

Version:
$Id: SqlSessionDaoSupport.java 3266 2010-11-22 06:56:51Z simone.tripodi $
See Also:
setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory), setSqlSessionTemplate(org.mybatis.spring.SqlSessionTemplate), SqlSessionTemplate

Field Summary
 
Fields inherited from class org.springframework.dao.support.DaoSupport
logger
 
Constructor Summary
SqlSessionDaoSupport()
           
 
Method Summary
protected  void checkDaoConfig()
          
 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.
 void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
           
 void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)
           
 
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
 

Constructor Detail

SqlSessionDaoSupport

public SqlSessionDaoSupport()
Method Detail

setSqlSessionFactory

public final void setSqlSessionFactory(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)

setSqlSessionTemplate

public final void setSqlSessionTemplate(SqlSessionTemplate sqlSessionTemplate)

getSqlSession

public final 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-2011 MyBatis.org. All Rights Reserved.