public interface Connection
OptimisticNamedCache
instances. A connection always has an associated transaction which is scoped within the connection. When a transaction is completed, a new transaction is started. Connections are in auto-commit mode by default. In auto-commit mode, each statement is executed in a distinct transaction and when the statement completes the transaction is committed and the connection is associated with a new transaction. A connection is not thread safe and may not be used by multiple threads concurrently.Modifier and Type | Method and Description |
---|---|
void |
close()
Close the logical connection.
|
void |
commit()
Commit the active transaction.
|
Isolation |
getIsolationLevel()
Determine the isolation level for the connection.
|
OptimisticNamedCache |
getNamedCache(String sTable)
Obtain an OptimisticNamedCache for the given table name.
|
TransactionState |
getTransactionState()
Obtain information about the active transaction.
|
int |
getTransactionTimeout()
Obtain the transaction timeout.
|
boolean |
isAutoCommit()
Determine whether the connection will produce transactions that are in auto-commit mode.
|
boolean |
isClosed()
Determine whether the connection has been closed.
|
boolean |
isEager()
Deterimine wheter connection is in eager mode.
|
void |
rollback()
Rollback the active transaction.
|
void |
setAutoCommit(boolean fAuto)
Specify whether transactions created by this connection are in auto-commit mode.
|
void |
setEager(boolean fEager)
Specify whether transactions produced by this connection will be in eager mode.
|
void |
setIsolationLevel(Isolation isolation)
Specify the isolation level that will be set on transactions produced by this connection.
|
void |
setTransactionTimeout(int nSeconds)
Set the transaction timeout.
|
OptimisticNamedCache getNamedCache(String sTable)
sTable
- the name of the table (cache)ConnectionClosedException
- if called after connection is closedvoid commit()
IllegalStateException
- if the connection is in auto-commit modeConnectionClosedException
- if called after connection is closedRollbackException
- if commit results in the transaction being rolled backvoid rollback()
IllegalStateException
- if the connection is in auto-commit modeConnectionClosedException
- if called after connection is closedvoid close()
boolean isClosed()
TransactionState getTransactionState()
void setAutoCommit(boolean fAuto)
If work has been done on the active transaction when this method is called with a value of "true", the work is rolled back.
fAuto
- if true, transactions will be in auto-commit modeConnectionClosedException
- if called after connection is closedboolean isAutoCommit()
void setEager(boolean fEager)
fEager
- if true, connection should be in eager modeConnectionClosedException
- if called after connection is closedboolean isEager()
void setIsolationLevel(Isolation isolation)
isolation
- the isolation levelIllegalStateException
- if transaction has any associated workConnectionClosedException
- if called after connection is closedIsolation getIsolationLevel()
void setTransactionTimeout(int nSeconds)
nSeconds
- the timeout in secondsint getTransactionTimeout()