|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.jcorporate.expresso.core.db.DBTransaction
Generic database transaction object - hides the implementation details of using jdbc and allows for JDBC message and exceptions to be handled better than by default. DBTransaction are also designed to be used in conjunction with connection pooling, and have special methods to support this.
| Field Summary | |
static String |
DEFAULT_DB_CONTEXT_NAME
Constant name for the 'Default' database context |
| Constructor Summary | |
DBTransaction()
Constructor Create a new connection object |
|
DBTransaction(DBConnectionPool pool)
Constructor Create a new connection object |
|
DBTransaction(String transactionDataContext)
Constructor Create a new connection object |
|
| Method Summary | |
void |
clear()
Clear all result sets and statements associated with this connection |
void |
commit()
Send a COMMIT to the database, closing the current transaction If the database driver claims it doesn't support transactions, then we skip this. |
String |
getDataContext()
Retrieve the data context name we're associated with |
String |
getDescription()
Returns the text description of this connection. |
int |
getId()
Get transaction id |
DBConnectionPool |
getPool()
|
DBConnection |
getTransactionConnection()
Low level function that allows you to retrieve the JDBC connection associated with this DBConnection. |
String |
getTransactionIdentifier()
Get transaction identifier which is myDescription + transactionId |
boolean |
isClosed()
When this connection has lost its connection to the server, tell whether or not it is available to be re-allocated |
boolean |
isConnected()
When this connection has lost its connection to the server, tell whether or not it is available to be re-allocated |
void |
release()
Releases the DBConnection back into the parent DBConnectionPool. |
void |
rollback()
Roll back the current transaction, as if it were never requested. |
void |
setDataContext(String newDBName)
Sets the data context for the connection. |
void |
setDescription(String newDescription)
Set a description for this database connection. |
void |
setPool(DBConnectionPool pool)
|
void |
setTransactionDirtyMode()
Set EXPRESSO transaction mode for the current DBConnection. |
void |
setTransactionExclusiveMode()
Set EXPRESSO transaction mode for the current DBConnection. |
void |
setTransactionReadOnlyMode()
Set EXPRESSO transaction mode for the current DBConnection. |
void |
setTransactionRestrictiveMode()
Set EXPRESSO transaction mode for the current DBConnection. |
void |
startTransaction()
Sets up the transaction operation on an identitied DBConnectionPool |
void |
startTransaction(boolean immortal)
Sets up the transaction operation on an identitied DBConnectionPool |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final String DEFAULT_DB_CONTEXT_NAME
| Constructor Detail |
public DBTransaction()
throws DBException
DBException - If the information provided cannot be used to
create a new connection
public DBTransaction(DBConnectionPool pool)
throws DBException
pool - The identified transaction pool
connection
DBException - If the information provided cannot be used to
create a new connection
public DBTransaction(String transactionDataContext)
throws DBException
transactionDataContext - The transaction data context
connection
DBException - If the information provided cannot be used to
create a new connection| Method Detail |
public void startTransaction()
throws DBException
DBException
public void startTransaction(boolean immortal)
throws DBException
DBException
public void clear()
throws DBException
DBException
public void commit()
throws DBException
DBException - If the commit does not succeedpublic DBConnection getTransactionConnection()
public String getDescription()
public boolean isClosed()
throws DBException
DBExceptionpublic boolean isConnected()
public void rollback()
throws DBException
DBException - If the rollback encounters an errorpublic void setDescription(String newDescription)
newDescription - Description of this connectionpublic void setDataContext(String newDBName)
newDBName - the datacontext name to usepublic String getDataContext()
public void release()
throws DBException
Releases the DBConnection back into the parent DBConnectionPool. Allows for syntax like:
DBConnection connection = DBConnectionPool.getInstance("default").getConnection();
[do stuff]
connection.release();
DBExceptionpublic DBConnectionPool getPool()
public void setPool(DBConnectionPool pool)
pool -
public void setTransactionReadOnlyMode()
throws DBException
DBException
public void setTransactionDirtyMode()
throws DBException
DBException
public void setTransactionRestrictiveMode()
throws DBException
DBException
public void setTransactionExclusiveMode()
throws DBException
DBExceptionpublic int getId()
public String getTransactionIdentifier()
|
Expresso 5-6 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||