[ Team LiB ] |
C.2 ExceptionsJDO has an exception-class hierarchy used to represent the various kinds of exceptions that may occur. The JDOException class is at the root of the hierarchy and provides all of the methods that an application calls. All of its subclasses merely provide constructors called strictly by the JDO implementation to indicate that an error has occurred. Since an application never calls these constructors, we omit them from the class descriptions.
This is the base class for errors that can be retried. public class JDOCanRetryException extends javax.jdo.JDOException { } SubclassesJDOUserException, JDODataStoreException
This class represents datastore exceptions that can be retried. public class JDODataStoreException extends javax.jdo.JDOCanRetryException { } SubclassesJDOObjectNotFoundException
This is the base class for all JDO exceptions. It is a subclass of RuntimeException, and it does not need to be declared or caught. It includes a descriptive String, an optional nested Exception array, and an optional failed Object. This class provides methods to retrieve the nested exception array and failed object. If there are multiple nested exceptions, then each might contain one failed object. This will be the case when an operation requires multiple instances (such as commit( ), makePersistentAll( ), etc.). If the JDO PersistenceManager is internationalized, the descriptive string will also be internationalized. public class JDOException extends java.lang.RuntimeException { public Object getFailedObject( ); public Throwable[] getNestedExceptions( ); public void printStackTrace( ); public void printStackTrace(PrintStream s); public void printStackTrace(PrintWriter s); public String toString( ); } SubclassesJDOCanRetryException, JDOFatalException
This is the base class for fatal datastore errors. It is derived from JDOFatalException. When this exception is thrown, the transaction has been rolled back without the user asking for it. The cause may be a connection timeout, an unrecoverable-media error, an unrecoverable-concurrency conflict, or other causes outside of the application's control. public class JDOFatalDataStoreException extends javax.jdo.JDOFatalException { } SubclassesJDOOptimisticVerificationException
This is the base class for errors that cannot be retried. It is derived from JDOException. This exception generally means that the transaction associated with the PersistenceManager has been rolled back, and the transaction should be abandoned. public class JDOFatalException extends javax.jdo.JDOException { } SubclassesJDOFatalDataStoreException, JDOFatalInternalException, JDOFatalUserException
This is the base class for JDO implementation failures. It is a derived class of JDOFatalException. This exception should be reported to the vendor for corrective action. There is no user action to recover. public class JDOFatalInternalException extends javax.jdo.JDOFatalException { }
This is the base class for user errors that cannot be retried. It is derived from JDOFatalException. Reasons for this exception include:
public class JDOFatalUserException extends javax.jdo.JDOFatalException { }
This exception notifies the application that an object does not exist in the datastore. This exception is thrown when a hollow instance is used to fetch an object that does not exist in the datastore. This exception might result from a call to getObjectById( ) with the validate parameter set to true, or from navigating to an object that no longer exists in the datastore. You will never get this exception as a result of executing a query. Throwing this exception does not change the status of any transaction in progress. The getFailedObject( ) method returns a reference to the failed instance. The failed instance is in the hollow state and has an identity that can be obtained by calling getObjectId( ) with the instance as a parameter. This can be used to determine the identity of the instance that could not be found. public class JDOObjectNotFoundException extends javax.jdo.JDODataStoreException { }
A verification step (described in Chapter 15) is performed on all instances that are new, modified, or deleted when you make a call to commit an optimistic transaction. If any instances fail this verification step, a JDOOptimisticVerificationException is thrown. It contains an array of nested exceptions; each nested exception contains an instance that failed verification. public class JDOOptimisticVerificationException extends javax.jdo.JDOFatalDataStoreException { }
This class is derived from JDOCanRetryException. This exception is thrown when an implementation does not implement an optional JDO feature. public class JDOUnsupportedOptionException extends javax.jdo.JDOUserException { }
This is the base class for user errors that can be retried. It is derived from JDOCanRetryException. Reasons for this exception include:
public class JDOUserException extends javax.jdo.JDOCanRetryException { } SubclassesJDOUnsupportedOptionException |
[ Team LiB ] |