|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
ITransaction | Represents a transaction that offers persistence access. |
ITransactionObserver | Observer that wants to be notificated about an ITransaction 's
events. |
Class Summary | |
---|---|
AbstractTransactionObserver | Implementation of ITransactionObserver that does not affect the
outrun of a transaction. |
PortalTransactionFactory | Factory for obtaining ITransaction instances. |
TransactionCleanupFilter | Cleanups the transactions in the thread, not properly disposed, after the request is processed. |
Exception Summary | |
---|---|
TransactionRequiredException | Indicates that a transaction is required but was not found. |
The portal transaction framework. Provides and manages transactions for persistence access.
The PortalTransactionFactory
provides methods for obtaining ITransaction
instances. Use PortalTransactionFactory.createTransaction(boolean)
for creating new transactions. The boolean parameter indicates if
the created transaction will be associated with the current thread as the
current active transaction. The current active transaction in a thread is
returned by
PortalTransactionFactory.getCurrentTransaction()
.
The the current transaction management is done by a stack associated with
the current thread. When an active transaction ends (by executing its
dispose
method), the previously active transaction
(next transaction in the stack) becomes the current transaction for the
thread.
The recommended code pattern for creating a new transaction is the following:
ITransaction transaction = PortalTransactionFactory.createTransaction(); // create transaction object
try
{
transaction.begin();
// execute transactional operations
transaction.commit();
}
finally
{
transaction.dispose(); // automatically rolls back if commit was not executed
}
|
||||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |