Skip Headers
Oracle TopLink Developer's Guide
10g Release 3 (10.1.3)
B13593-01
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
Next
Next
 

Handling Exceptions

Most exceptions in queries are database exceptions, resulting from a failure in the database operation (see Database Exceptions (4002 – 4018) section in the TopLink Exception Reference chapter for more information). Write operations can also throw an OptimisticLockException on a write, update, or delete operation in applications that use optimistic locking. To catch these exceptions, execute all database operations within a try-catch block:

{
    try
    {
        Vector employees = session.readAllObjects(Employee.class); 
    } 
        catch (DatabaseException exception)
    {
        // Handle exception 
    }
}

See Chapter 14, "TopLink Workbench Error Reference" for more information about exceptions in a TopLink application.