org.mybatis.spring
Class SqlSessionHolder

java.lang.Object
  extended by org.springframework.transaction.support.ResourceHolderSupport
      extended by org.mybatis.spring.SqlSessionHolder
All Implemented Interfaces:
org.springframework.transaction.support.ResourceHolder

public final class SqlSessionHolder
extends org.springframework.transaction.support.ResourceHolderSupport

Used to keep current SqlSession in TransactionSynchronizationManager. The SqlSessionFactory that created that SqlSession is used as a key. ExecutorType is also kept to be able to check if the user is trying to change it during a TX (that is not allowed) and throw a Exception in that case.

Version:
$Id: SqlSessionHolder.java 3406 2010-12-20 17:58:31Z eduardo.macarron $

Constructor Summary
SqlSessionHolder(org.apache.ibatis.session.SqlSession sqlSession, org.apache.ibatis.session.ExecutorType executorType, org.springframework.dao.support.PersistenceExceptionTranslator exceptionTranslator)
          Creates a new holder instance.
 
Method Summary
 org.apache.ibatis.session.ExecutorType getExecutorType()
           
 org.springframework.dao.support.PersistenceExceptionTranslator getPersistenceExceptionTranslator()
           
 org.apache.ibatis.session.SqlSession getSqlSession()
           
 
Methods inherited from class org.springframework.transaction.support.ResourceHolderSupport
clear, getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SqlSessionHolder

public SqlSessionHolder(org.apache.ibatis.session.SqlSession sqlSession,
                        org.apache.ibatis.session.ExecutorType executorType,
                        org.springframework.dao.support.PersistenceExceptionTranslator exceptionTranslator)
Creates a new holder instance.

Parameters:
sqlSession - the SqlSession has to be hold.
executorType - the ExecutorType has to be hold.
Method Detail

getSqlSession

public org.apache.ibatis.session.SqlSession getSqlSession()

getExecutorType

public org.apache.ibatis.session.ExecutorType getExecutorType()

getPersistenceExceptionTranslator

public org.springframework.dao.support.PersistenceExceptionTranslator getPersistenceExceptionTranslator()


Copyright © 2010-2011 MyBatis.org. All Rights Reserved.