public class LocalTransactionManager extends Object implements TransactionManager, Closeable
事务栈:
事务管理器允许使用不同的传播属性反复开启新的事务。所有被开启的事务在正确处置(commit,rollback) 它们之前都会按照先后顺序依次压入事务管理器的“事务栈”中。一旦有事务被处理(commit,rollback)这个事务才会被从事务栈中弹出。
倘若被弹出的事务(A)并不是栈顶的事务,那么在事务(A)被处理(commit,rollback)时会优先处理自事务(A)以后开启的其它事务。
| 构造器和说明 |
|---|
LocalTransactionManager(DataSource dataSource) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbegin, beginpublic LocalTransactionManager(DataSource dataSource)
public DataSource getDataSource()
public boolean hasTransaction()
hasTransaction 在接口中 TransactionManagerpublic boolean isTopTransaction(TransactionStatus status)
isTopTransaction 在接口中 TransactionManagerpublic void commit()
throws SQLException
TransactionManagercommit 在接口中 TransactionManagerSQLExceptionpublic void rollBack()
throws SQLException
TransactionManagerrollBack 在接口中 TransactionManagerSQLExceptionpublic final TransactionStatus begin(Propagation behavior, Isolation level) throws SQLException
begin 在接口中 TransactionManagerSQLExceptionPropagation,
Connection.setTransactionIsolation(int)protected void doBegin(LocalTransactionStatus defStatus) throws SQLException
SQLExceptionpublic final void commit(TransactionStatus status) throws SQLException
commit 在接口中 TransactionManagerSQLExceptionprotected void doCommit(LocalTransactionStatus defStatus) throws SQLException
SQLExceptionpublic final void rollBack(TransactionStatus status) throws SQLException
rollBack 在接口中 TransactionManagerSQLExceptionprotected void doRollback(LocalTransactionStatus defStatus) throws SQLException
SQLExceptionprotected final void suspend(LocalTransactionStatus defStatus) throws SQLException
SQLExceptionprotected final void resume(LocalTransactionStatus defStatus) throws SQLException
SQLExceptionprotected TransactionObject doGetConnection(LocalTransactionStatus defStatus) throws SQLException
SQLExceptionpublic TransactionTemplate getTransactionTemplate()
TransactionTemplatepublic LocalTransactionStatus lastTransaction()
LocalTransactionStatuspublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableIOExceptionCopyright © 2021. All rights reserved.