Common Delegate Usage
Note: This section is intended for experts.
A number of control points are provided that let you customize fetch operations in Enterprise Objects applications. Table 6-2 lists the delegate methods in EODatabaseContext that you can use to customize fetch operations.
You can set the delegate of EODatabaseContext by invoking the class method EODatabaseContext.setDefaultDelegate.
Table 5-2 EODatabaseContext delegate methodsMethod | Description |
databaseContextShouldSelectObjects
| Invoked just before a SELECT operation occurs. Use this delegate method to return false to tell the adaptor channel to skip the SELECT. You might want to do this to issue your own custom SQL to the adaptor. |
databaseContextShouldUsePessimisticLock
| Use this delegate method to selectively turn off the locking of rows when you’re using a pessimistic locking strategy. |
databaseContextDidSelectObjects
| Invoked immediately after a SELECT operation occurs. You can use it to log diagnostic information or initialize internal state for subsequent fetches. |
databaseContextShouldFetchObjects
| Use this method to satisfy an editing context’s fetch request from its snapshot cache. |
databaseContextDidFetchObjects
| Invoked after an EODatabaseContext fetches objects. Use it to record in a local cache the results of a fetch. |
databaseContextFailedToFetchObject
| Invoked when a to-one fault cannot find its data in the database. Use this method to immediately throw an exception. |
databaseContextShouldLockObjectWithGlobalID
| Invoked from lockObjectWithGlobalID. Use it to implement custom locking. |
databaseContextShouldRaiseExceptionForLockFailure
| Use this method to suppress an exception that occurs when EODatabaseContext attempts to lock an object. |
databaseContextShouldUpdateCurrentSnapshot
| Invoked when an EODatabaseContext already has a snapshot for a row fetched from the database. Use it to compare the snapshots and possibly resolve conflicts. |