|
Oracle® OLAP Java API Reference 11g Release 1 (11.1) B28128-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TransactionProvider
An interface that defines an OLAP transaction provider. The Oracle OLAP Java API implementation of this interface provides methods to get Transaction
objects and to commit or roll back the changes an application makes during a Transaction
. An application gets a TransactionProvider
by calling the
method of the getTransactionProvider
DataProvider
for the session.
A transaction is represented by an instance of the Oracle OLAP Java API implementation of the Transaction
interface. An application does not directly create new Transaction
objects. Instead, a TransactionProvider
supplies them as they are needed. Only one Transaction
is the current Transaction
at any one time. With the methods of a TransactionProvider
, an application can get the current Transaction
or set a previously saved Transaction
as the current Transaction
.
Creating a derived Source
or changing the state of a Template
occurs in a transaction context. A TransactionProvider
ensures the following:
An application creates a derived Source
or changes the state of a Template
in the current Transaction
. A Source
or state change is active, or valid, in the Transaction
in which in which it was created or modified, or in a child of that Transaction
. Any changes that occur in the child Transaction
do not take effect in the parent Transaction
until the application commits the Transaction
by calling the commitCurrentTransaction
method of the TransactionProvider
. The only Source
that can be modified is one produced by a Template
and which therefore has a DynamicDefinition
as a proxy for the ImmutableDefinition
that is associated with the Source
.
When the application calls the commitCurrentTransaction
method, the state of the child Transaction
moves up into the parent Transaction
. The child Transaction
disappears. The updated Transaction
is still the parent Transaction
for any other child Transaction
of the original parent Transaction
. If the application does not want to commit a child Transaction
into the parent Transaction
, then it can call the rollbackCurrentTransaction
method. The TransactionProvider
then discards any changes made in the child Transaction
and makes the parent Transaction
the current Transaction
.
The following example illustrates a rollback.
// dp is the DataProvider for the session. TransactionProvider transactionProvider = dp.getTransactionProvider(); // Save the top-level Transaction. Transaction parent = transactionProvider.getCurrentTransaction(); // Begin a child Transaction. transactionProvider.beginSubtransaction(); // The createCube() method returns a Source that was produced by a Template. // That Source represents the joining of a measure and some dimensions into a cube. // The context input parameter is an object that supplies a MetadataProvider and a // DataProvider for the cube Template to use to get primary Source objects and // derived Source objects. // Create a cube in the child Transaction. Source cube = createCube(context); // Save the child Transaction. Transaction child = transactionProvider.getCurrentTransaction(); // Begin a grandchild Transaction. transactionProvider.beginSubtransaction(); // Add another dimension as an edge. cube.addEdge(edge); // Discard the grandchild Transaction that added the edge. transactionProvider.rollbackCurrentTransaction(); // Prepare and commit the child Transaction. transactionProvider.prepareCurrentTransaction(); transactionProvider.commitCurrentTransaction(); // The cube now exists in the parent Transaction.
Cursor
, Source
, Template
Method Summary | |
---|---|
Transaction |
beginSubtransaction() Begins a child Transaction of the current Transaction . |
void |
commitCurrentTransaction() Moves the state of a child Transaction into the parent Transaction . |
Transaction |
createRootTransaction(UserSession session) Creates a new root Transaction for the specified UserSession . |
Transaction |
getCurrentTransaction() Gets the current Transaction . |
void |
prepareCurrentTransaction() Calling this method before calling commitCurrentTransaction is no longer necessary. |
void |
rollbackCurrentTransaction() Rolls back, or undoes, any OLAP API operations the application performed in the current Transaction . |
void |
setCurrentTransaction(Transaction transaction) Specifies a Transaction as the current Transaction . |
Method Detail |
---|
Transaction getCurrentTransaction()
Transaction
.Transaction
.void setCurrentTransaction(Transaction transaction)
Transaction
as the current Transaction
.transaction
- A Transaction
object to specify as the current Transaction
.void prepareCurrentTransaction() throws NotCommittableException, TransactionInactiveException, ActiveSubtransactionsException
commitCurrentTransaction
is no longer necessary.
Prepares the current Transaction
for committing.
NotCommittableException
TransactionInactiveException
ActiveSubtransactionsException
void commitCurrentTransaction() throws CommitException, TransactionInactiveException, ActiveSubtransactionsException
Transaction
into the parent Transaction
. Before calling commitCurrentTransaction
, an application must call prepareCurrentTransaction
.CommitException
TransactionInactiveException
ActiveSubtransactionsException
void rollbackCurrentTransaction() throws TransactionInactiveException, ActiveSubtransactionsException
Transaction
. The TransactionProvider
discards the operations the application performed in the child Transaction
and makes the parent Transaction
the current Transaction
.TransactionInactiveException
ActiveSubtransactionsException
Transaction beginSubtransaction() throws TransactionInactiveException
Transaction
of the current Transaction
. The child Transaction
becomes the current Transaction
.Transaction
object that represents the current Transaction
.TransactionInactiveException
Transaction createRootTransaction(UserSession session)
Transaction
for the specified UserSession
.session
- The UserSession
for which to create a new root Transaction
.Transaction
that is the root Transaction
for the UserSession
.
|
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |