Package com.aspectran.mybatis
Class SqlSessionTxAdvice
- java.lang.Object
-
- com.aspectran.mybatis.SqlSessionTxAdvice
-
public class SqlSessionTxAdvice extends java.lang.Object
Advice for SqlSession Transactions.- Since:
- 2015. 04. 03.
- Author:
- Juho Jeong
-
-
Constructor Summary
Constructors Constructor Description SqlSessionTxAdvice(org.apache.ibatis.session.SqlSessionFactory sqlSessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the session.void
close(boolean arbitrarily)
Closes the session arbitrarily.void
commit()
Flushes batch statements and commits database connection.void
commit(boolean force)
Flushes batch statements and commits database connection.org.apache.ibatis.session.SqlSession
getSqlSession()
Returns an open SqlSession.boolean
isArbitrarilyClosed()
Returns whether the session is arbitrarily closed.void
open()
Opens a new SqlSession and store its instance inside.void
open(boolean autoCommit)
void
open(java.lang.String executorType)
void
open(java.lang.String executorType, boolean autoCommit)
void
rollback()
Discards pending batch statements and rolls database connection back.void
rollback(boolean force)
Discards pending batch statements and rolls database connection back.void
setAutoCommit(boolean autoCommit)
void
setExecutorType(java.lang.String executorType)
-
-
-
Method Detail
-
setAutoCommit
public void setAutoCommit(boolean autoCommit)
-
setExecutorType
public void setExecutorType(java.lang.String executorType)
-
getSqlSession
public org.apache.ibatis.session.SqlSession getSqlSession()
Returns an open SqlSession. If no SqlSession is open then return null.- Returns:
- a SqlSession instance
-
open
public void open()
Opens a new SqlSession and store its instance inside. Therefore, whenever there is a request for a SqlSessionTxAdvice bean, a new bean instance of the object must be created.
-
open
public void open(boolean autoCommit)
-
open
public void open(java.lang.String executorType)
-
open
public void open(java.lang.String executorType, boolean autoCommit)
-
commit
public void commit()
Flushes batch statements and commits database connection. Note that database connection will not be committed if no updates/deletes/inserts were called. To force the commit callcommit(boolean)
-
commit
public void commit(boolean force)
Flushes batch statements and commits database connection.- Parameters:
force
- forces connection commit
-
rollback
public void rollback()
Discards pending batch statements and rolls database connection back. Note that database connection will not be rolled back if no updates/deletes/inserts were called. To force the rollback callrollback(boolean)
-
rollback
public void rollback(boolean force)
Discards pending batch statements and rolls database connection back. Note that database connection will not be rolled back if no updates/deletes/inserts were called.- Parameters:
force
- forces connection rollback
-
close
public void close()
Closes the session.
-
close
public void close(boolean arbitrarily)
Closes the session arbitrarily. If the transaction advice does not finally close the session, the session will automatically reopen whenever necessary.- Parameters:
arbitrarily
- true if the session is closed arbitrarily; otherwise false
-
isArbitrarilyClosed
public boolean isArbitrarilyClosed()
Returns whether the session is arbitrarily closed.- Returns:
- whether the session is arbitrarily closed
-
-