public interface CDOUserTransaction
single
transactions and distributed
(XA) transactions.Modifier and Type | Method and Description |
---|---|
CDOCommitInfo |
commit()
Same as
commit(null) . |
CDOCommitInfo |
commit(IProgressMonitor progressMonitor)
Commits the modifications of this transaction to the repository and returns a
commit info object if successful. |
CDOUserSavepoint |
getLastSavepoint() |
void |
rollback() |
CDOUserSavepoint |
setSavepoint()
Creates a save point in the
CDOTransaction that can be used to roll back a part of the transaction
Save points do not involve the server side, everything is done on the client side. |
CDOCommitInfo commit() throws ConcurrentAccessException, CommitException
commit(null)
.ConcurrentAccessException
CommitException
CDOCommitInfo commit(IProgressMonitor progressMonitor) throws ConcurrentAccessException, CommitException
commit info
object if successful.
Various kinds of problems can cause the commit to fail and not all of them can be avoided by acquiring pessimistic locks
on the modified objects. In particular you must expect and handle containment cycle exceptions
. The following example shows how
write robust transactions:
CDOTransaction transaction = null; try { transaction = session.openTransaction(); for (;;) { try { synchronized (transaction) { CDOResource resource = transaction.getResource("/stock/resource1"); // Modify the model here... transaction.commit(); break; } } catch (ConcurrentAccessException ex) { transaction.rollback(); } catch (CommitException ex) { throw ex.wrap(); } } } finally { if (transaction != null) { transaction.close(); } }Note that the transaction stays functional after a any call to the
commit()
methods. If the transaction is not closed after a commit
it can be used to apply additional modifications to the model.ConcurrentAccessException
CommitException
void rollback()
CDOUserSavepoint setSavepoint()
CDOTransaction
that can be used to roll back a part of the transaction
Save points do not involve the server side, everything is done on the client side.
CDOUserSavepoint getLastSavepoint()
Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.