Side of Software
Persistence Library 2.0

sos.db
Class TransactionAbortedException

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by sos.db.TransactionAbortedException
All Implemented Interfaces:
java.io.Serializable

public class TransactionAbortedException
extends java.lang.RuntimeException

A run-time exception (intended to be checked) that indicates a transaction has unexpectedly aborted and rolled back. The exception may be thrown during calls to Database.startTransaction(), Database.commitTransaction(sos.db.Progress), Database.addObject(java.lang.Object), or any method on a database object.

When a transaction aborts, the client application is responsible for handling the failure. The application may wish to retry the transaction or inform the user that the transaction wasn't successful, for example.

If the transactions are nested, a TransactionAbortedException indicates that the inner-most transaction has aborted. If the client wishes to abort the topmost transaction as a result of an inner abortion, the client should catch the inner exception, abort the topmost transaction programmatically, and rethrow the exception, as follows:

  try {
    db.startTransaction();

    try {
      // perform a nested transaction
    }
    catch( TransactionAbortedException tae ) {
      // abort the outer transaction
      db.abortTransaction();
      throw tae;
    }

    db.commitTransaction();
  }
  catch( TransactionAbortedException tae2 ) {
    Throwable cause = tae2.getCause();

    // Handle the failure.
    //
    // This may mean retrying the transaction or
    // informing the user that it wasn't successful, e.g.
  }

Since:
1.0
See Also:
Database.commitTransaction(sos.db.Progress), Database.abortTransaction(), Database.startTransaction(), Database.addObject(java.lang.Object)

Constructor Summary
TransactionAbortedException(java.lang.Throwable cause)
          Creates an instance of TransactionAbortedException with the specified underlying cause.
 
Method Summary
 
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransactionAbortedException

public TransactionAbortedException(java.lang.Throwable cause)
Creates an instance of TransactionAbortedException with the specified underlying cause.

Parameters:
cause - reason why the transaction was aborted

Side of Software
Persistence Library 2.0

Copyright 2004-08 Side of Software (SOS). All rights reserved.