public final class SqlSessionUtils extends Object
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
closeSqlSession(org.apache.ibatis.session.SqlSession session,
org.apache.ibatis.session.SqlSessionFactory sessionFactory)
Checks if
SqlSession passed as an argument is managed by Spring TransactionSynchronizationManager
If it is not, it closes it, otherwise it just updates the reference counter and
lets Spring call the close callback when the managed transaction ends |
static org.apache.ibatis.session.SqlSession |
getSqlSession(org.apache.ibatis.session.SqlSessionFactory sessionFactory)
Creates a new MyBatis
SqlSession from the SqlSessionFactory
provided as a parameter and using its DataSource and ExecutorType |
static org.apache.ibatis.session.SqlSession |
getSqlSession(org.apache.ibatis.session.SqlSessionFactory sessionFactory,
org.apache.ibatis.session.ExecutorType executorType,
org.springframework.dao.support.PersistenceExceptionTranslator exceptionTranslator) |
static boolean |
isSqlSessionTransactional(org.apache.ibatis.session.SqlSession session,
org.apache.ibatis.session.SqlSessionFactory sessionFactory)
Returns if the
SqlSession passed as an argument is being managed by Spring |
public static org.apache.ibatis.session.SqlSession getSqlSession(org.apache.ibatis.session.SqlSessionFactory sessionFactory)
SqlSession from the SqlSessionFactory
provided as a parameter and using its DataSource and ExecutorTypesessionFactory - a MyBatis SqlSessionFactory to create new sessionsSqlSessionorg.springframework.dao.TransientDataAccessResourceException - if a transaction is active and the
SqlSessionFactory is not using a SpringManagedTransactionFactorypublic static org.apache.ibatis.session.SqlSession getSqlSession(org.apache.ibatis.session.SqlSessionFactory sessionFactory,
org.apache.ibatis.session.ExecutorType executorType,
org.springframework.dao.support.PersistenceExceptionTranslator exceptionTranslator)
public static void closeSqlSession(org.apache.ibatis.session.SqlSession session,
org.apache.ibatis.session.SqlSessionFactory sessionFactory)
SqlSession passed as an argument is managed by Spring TransactionSynchronizationManager
If it is not, it closes it, otherwise it just updates the reference counter and
lets Spring call the close callback when the managed transaction endssession - sessionFactory - public static boolean isSqlSessionTransactional(org.apache.ibatis.session.SqlSession session,
org.apache.ibatis.session.SqlSessionFactory sessionFactory)
SqlSession passed as an argument is being managed by Springsession - a MyBatis SqlSession to checksessionFactory - the SqlSessionFactory which the SqlSession was built withCopyright © 2017. All rights reserved.