Package network.oxalis.persistence.api
Interface JdbcTxManager
-
- All Known Implementing Classes:
JdbcTxManagerImpl
public interface JdbcTxManagerManages JDBC transactions. Provides access to the connection object which is automagically fetched as long as the the method is in a class annotated with @Repository or the method is annotated with @Transactional The connection is stored in ThreadLocal User: andy Date: 8/9/12 Time: 1:23 PM
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidcleanUp()Closes the connection and removes the connection from the thread localvoidcommit()Commits the current connection Requires that the existing connection was created with autocommit set to false.ConnectiongetConnection()Gets the connection that is currently being used.booleanisConnection()Checks if the current connection is null.booleanisTransaction()Checks whether the current connection is not null and autocomit is set to false.voidnewConnection(boolean autoCommit)N.B.voidrollback()Rollbacks the current connectionvoidsetRollbackOnly()Marks the transaction for rollback when completing.voidtrace(String message)
-
-
-
Method Detail
-
isTransaction
boolean isTransaction()
Checks whether the current connection is not null and autocomit is set to false.- Returns:
-
isConnection
boolean isConnection()
Checks if the current connection is null.- Returns:
-
newConnection
void newConnection(boolean autoCommit)
N.B. DO NOT USE THIS METHOD DIRECTLY. It is only to be used by the TransactionalMethodInterceptor and the RepositoryConnectionMethodInterceptor Makes a Connection object available from the getConnection() method with either autocomit set to true or false.- Parameters:
autoCommit- automatically commits after each execute. Set to false to use transactions.
-
commit
void commit()
Commits the current connection Requires that the existing connection was created with autocommit set to false.
-
rollback
void rollback()
Rollbacks the current connection
-
cleanUp
void cleanUp()
Closes the connection and removes the connection from the thread local
-
getConnection
Connection getConnection()
Gets the connection that is currently being used.- Returns:
-
setRollbackOnly
void setRollbackOnly()
Marks the transaction for rollback when completing. The connection will always be rolled back even when an exception does not occur.
-
trace
void trace(String message)
-
-