org.modelsphere.jack.baseDb.db
Class DbException
java.lang.Object
java.lang.Throwable
java.lang.Exception
org.modelsphere.jack.baseDb.db.DbException
- All Implemented Interfaces:
- java.io.Serializable
- Direct Known Subclasses:
- DbDeadObjectException, DbMaxConnectivityException
public class DbException
- extends java.lang.Exception
A DbException is thrown when an invalid operation is performed such as accessing objects outside
a transaction or attempting to set invalid values. They may also result from invalid states such
as trying to commit/abort a transaction when no transactions has been initiated.
When a DbException occurs, opened transactions if any exists, are rolled back.
Because all the transactions are aborted when a DbException is thrown, the try/catch block should
be installed around the outermost transaction (which should be at the outermost level of the
command execution). All the methods that access DbObjects should be declared
throws DbException
and should not catch the DbException themselves. A transaction at
the outermost level should be coded as follows:
import jack.srtool.ApplicationContext;
import jack.util.ExceptionHandler;
try {
db.beginWriteTrans(“action”);
performAction();
db.commitTrans();
} catch (Exception e) {
MainFrame frame = ApplicationContext.getDefaultMainFrame();
ExceptionHandler.processUncatchedException(frame, e);
} //end try
- See Also:
- Serialized Form
Methods inherited from class java.lang.Throwable |
fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, initCause, printStackTrace, setStackTrace, toString |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
DbException
public DbException(Db db,
java.lang.String message)
getTargetException
public java.lang.Throwable getTargetException()
printStackTrace
public void printStackTrace(java.io.PrintStream ps)
- Overrides:
printStackTrace
in class java.lang.Throwable
printStackTrace
public void printStackTrace(java.io.PrintWriter pw)
- Overrides:
printStackTrace
in class java.lang.Throwable
getMessage
public java.lang.String getMessage()
- Overrides:
getMessage
in class java.lang.Throwable
Open ModelSphere 2007. All Rights Reserved.