public class Transaction extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
COMMITTED
Status for committed transactions
|
static int |
OPENED
Status for opened transactions
|
static int |
ROLLEDBACK
Status for roll backed transactions
|
| Constructor and Description |
|---|
Transaction()
Constructor
|
Transaction(Plugin plugin)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
beginTransaction(Plugin plugin)
Begin a transaction
|
void |
commit()
Commit the transaction
|
void |
executeStatement()
Execute the current statement
|
protected void |
finalize()
Checks that the transaction has been committed (or rolled back) before
being destroyed and release all transaction resources (statement,
connection, ...) if not.
|
protected Connection |
getConnection()
Get the underlying connection.
|
PreparedStatement |
getStatement()
The current prepared statement
|
int |
getStatus()
Return the transaction status
|
PreparedStatement |
prepareStatement(String strSQL)
Gets a prepared statement
|
void |
rollback()
Rollback the transaction
|
void |
rollback(Exception e)
Rollback the transaction
|
public static final int OPENED
public static final int COMMITTED
public static final int ROLLEDBACK
public Transaction()
public Transaction(Plugin plugin)
plugin - The plugin owner of the transactionpublic PreparedStatement prepareStatement(String strSQL) throws SQLException
strSQL - The SQL statementSQLException - If an SQL error occurspublic PreparedStatement getStatement()
public void executeStatement()
throws SQLException
SQLException - If an SQL error occurspublic void commit()
public void rollback()
public void rollback(Exception e)
e - The exception that cause the rollbackpublic int getStatus()
protected Connection getConnection()
protected void beginTransaction(Plugin plugin)
plugin - The plugin owner of the transactionCopyright © 2016 City of Paris. All rights reserved.