Working with Events

Use the event manager to specify specific events to occur whenever TopLink performs a read, update, delete, or insert on the database.


Note: TopLink uses the Java event model.

Applications can receive descriptor events in the following ways:

Objects that implement the DescriptorEventListener interface can be registered with the descriptor event manager to be notified when any event occurs for that descriptor.

Alternately, you may wish to use the DescriptorEventAdapter class if your application does not require all the methods defined in the interface. The DescriptorEventAdapter implements the DescriptorEventListener interface and defines an empty method for each method in the interface. To use the adapter, you must subclass it and then register your new object with the descriptor event manager.

You can use descriptor events in many ways, including:

Use the descriptor's Event tab (see Figure 4-12) to specify events for a descriptor.

Example 4-6 Event Example

To invoke a method called postBuild() for an Employee object, the postBuild() method must be implemented in the Employee class. This method must also accept one parameter that is an instance of DescriptorEvent fully qualified with a package name.


Related Topics

About TopLink Descriptors

Registering an Event with a Descriptor
Supported Events

Specifying Events
Working with Descriptors

 

Copyright © 1997, 2004, Oracle. All rights reserved.