public class SQLTransaction extends Object implements AutoCloseable, HasSQLConnection
| Modifier and Type | Class and Description |
|---|---|
static class |
SQLTransaction.IsolationLevel |
| Modifier and Type | Method and Description |
|---|---|
static SQLTransaction |
begin(Connection conn)
Begin a new SQL transaction in R/W mode and default isolation level
|
static SQLTransaction |
begin(Connection conn,
boolean readOnly,
SQLTransaction.IsolationLevel level)
Begin a new SQL transaction
|
static SQLTransaction |
begin(DataSource ds)
Begin a new SQL transaction in R/W mode and default isolation level
|
static SQLTransaction |
begin(DataSource ds,
boolean readOnly,
SQLTransaction.IsolationLevel level)
Begin a new SQL transaction
|
void |
close() |
void |
commit()
Commit the current transaction
|
SQLSavepoint |
createSavepoint(String name)
Create a new savepoint
|
Connection |
getConnection() |
void |
rollback()
Rollback the current transaction
|
public static SQLTransaction begin(DataSource ds)
ds - The SQL data source to usepublic static SQLTransaction begin(DataSource ds, boolean readOnly, SQLTransaction.IsolationLevel level)
ds - The SQL data source to usereadOnly - Indicates if the transaction must be read-onlylevel - The isolation level. If null the default value is usedpublic static SQLTransaction begin(Connection conn)
conn - The base connection to usepublic static SQLTransaction begin(Connection conn, boolean readOnly, SQLTransaction.IsolationLevel level)
conn - The base connection to usereadOnly - Indicates if the transaction must be read-onlylevel - The isolation level. If null the default value is usedpublic SQLSavepoint createSavepoint(String name)
name - The savepoint unique namepublic void commit()
throws SQLFaultException
SQLFaultException - Commit errorpublic void rollback()
throws SQLFaultException
SQLFaultException - Rollback errorpublic void close()
throws SQLFaultException
close in interface AutoCloseableSQLFaultExceptionpublic Connection getConnection()
getConnection in interface HasSQLConnectionCopyright © 2018. All rights reserved.