|
Side of Software Persistence Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Throwable java.lang.Exception java.lang.RuntimeException sos.db.TransactionAbortedException
public class TransactionAbortedException
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. }
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 |
---|
public TransactionAbortedException(java.lang.Throwable cause)
TransactionAbortedException
with the
specified underlying cause.
cause
- reason why the transaction was aborted
|
Side of Software Persistence Library 2.0 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |