Package org.mybatis.spring
Class SqlSessionHolder
- java.lang.Object
-
- org.springframework.transaction.support.ResourceHolderSupport
-
- org.mybatis.spring.SqlSessionHolder
-
- All Implemented Interfaces:
org.springframework.transaction.support.ResourceHolder
public final class SqlSessionHolder extends org.springframework.transaction.support.ResourceHolderSupportUsed to keep currentSqlSessioninTransactionSynchronizationManager. TheSqlSessionFactorythat created thatSqlSessionis used as a key.ExecutorTypeis 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.- Author:
- Hunter Presnall, Eduardo Macarron
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.ibatis.session.ExecutorTypegetExecutorType()org.springframework.dao.support.PersistenceExceptionTranslatorgetPersistenceExceptionTranslator()org.apache.ibatis.session.SqlSessiongetSqlSession()-
Methods inherited from class org.springframework.transaction.support.ResourceHolderSupport
clear, getDeadline, getTimeToLiveInMillis, getTimeToLiveInSeconds, hasTimeout, isOpen, isRollbackOnly, isSynchronizedWithTransaction, isVoid, released, requested, reset, resetRollbackOnly, setRollbackOnly, setSynchronizedWithTransaction, setTimeoutInMillis, setTimeoutInSeconds, unbound
-
-
-
-
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- theSqlSessionhas to be hold.executorType- theExecutorTypehas to be hold.exceptionTranslator- thePersistenceExceptionTranslatorhas 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()
-
-