JDO exceptions JDO defines a number of exceptions

JDO exceptions JDO defines a number of exceptions to represent error conditions that might arise in the various layers of an implementation. These are all defined to be runtime exceptions. Since the compiler does not check such exceptions, the application is free to catch only those exceptions that warrant a particular response. This philosophy allows JDO to be more transparently applied to existing domain models and application components than would have been the case if checked exceptions were employed. In this chapter we look at the JDO exception hierarchy, examine the base class exceptions and their subclass exceptions, and look at a selection of situations that might give rise to them. Why runtime and not checked exceptions? The choice of whether to use checked or runtime (unchecked) exceptions in a new API is one which must be considered carefully, as each style of exception has its place. For instance, in Remote Method Invocation (RMI), RemoteException is a checked exception. The choice was made deliberately so that developers would always know when they were executing a remote method call. This was deemed necessary, as remote calls are particularly slow. In JDO, however, the primary focus is transparency. We aim to provide a persistence infrastructure that can be applied easily without the addition of JDO-specific code to domain classes. Some methods of JDO instances, which work fine when the instance is in the transient state, might throw JDO exceptions from other states; for example, attempting to interact with a persistent instance when no transaction is active, or when the persistence manager has been closed. In order to retain the high level of transparency desired, all of the JDO exceptions are runtime exceptions. 9.1 JDO exception hierarchy Exceptions arising through JDO fall into a number of categories. Exceptions may be fatal (the requested operation cannot be completed) or can be retried (the error can be corrected by the application and the operation attempted
Note: If you are looking for reliable and quality webspace company to host and run your servlet application check Actions servlet hosting services

Comments are closed.