8.1 Transactions

A compliant content repository may support transactions. If it does so, it must adhere to the Java Transaction API (JTA) specification (see http://java.sun.com/products/jta/index.html).

Whether a particular implementation supports transactions can be determined by querying the repository descriptor table with Repository.getDescriptor("OPTION_TRANSACTIONS_SUPPORTED") (a return value of true indicates support for transactions, see Repository Descriptors).

The actual methods used to control transaction boundaries are not defined by this specification (that is why there are no begin, commit or rollback methods in this API). These methods are defined by the JTA specification.

The JTA provides for two general approaches to transactions, container managed transactions and user managed transactions. In the first case, container managed transactions, the transaction management is taken care of by the application server and it is entirely transparent to the application using the API. The JTA interfaces javax.transaction.TransactionManager and javax.transaction.Transaction are the relevant ones in this context (though the client, as mentioned, will never have a need to use these).

In the second case, user managed transactions, the application using the API may choose to control transaction boundaries from within the application. In this case the relevant interface is javax.transaction.UserTransaction. This is the interface that provides the methods begin, commit, rollback and so forth. Note that behind the scenes the javax.transaction.TransactionManager and javax.transaction.Transaction are still employed, but again, the client does not deal with these.

A content repository implementation must support both of these approaches.