public class JdbcTxManagerImpl extends Object implements JdbcTxManager
It is responsible for fetching Connection objects from a DataSource, and setting them up so that they can be transactional (autoCommit --> false).
It also can be used to rollback programatically an existing transaction.
| Constructor and Description |
|---|
JdbcTxManagerImpl(DataSource dataSource) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Closes the connection and removes the connection from the thread local
|
void |
commit()
Commits the current connection
Requires that the existing connection was created with autocommit set to false.
|
Connection |
getConnection()
Gets the connection
|
boolean |
isConnection()
Checks if the current connection is null.
|
boolean |
isTransaction()
Checks whether the current connection is not null and autocomit is set to false.
|
void |
newConnection(boolean autoCommit)
N.B.
|
void |
rollback()
Rollbacks the current connection
|
void |
setRollbackOnly()
marks the transaction to be rollbacked
|
void |
trace(String message)
logs a debug message with the current transaction object
|
@Inject public JdbcTxManagerImpl(DataSource dataSource)
public boolean isTransaction()
JdbcTxManagerisTransaction in interface JdbcTxManagerpublic boolean isConnection()
JdbcTxManagerisConnection in interface JdbcTxManagerpublic void newConnection(boolean autoCommit)
JdbcTxManagernewConnection in interface JdbcTxManagerautoCommit - automatically commits after each execute. Set to false to use transactions.public void commit()
JdbcTxManagercommit in interface JdbcTxManagerpublic void rollback()
JdbcTxManagerrollback in interface JdbcTxManagerpublic void cleanUp()
JdbcTxManagercleanUp in interface JdbcTxManagerpublic Connection getConnection()
getConnection in interface JdbcTxManagerpublic void setRollbackOnly()
setRollbackOnly in interface JdbcTxManagerpublic void trace(String message)
trace in interface JdbcTxManagermessage - Copyright © 2021 NorStella. All rights reserved.