Oracle JDeveloper Tip

ADF Equivalents of Common Oracle Forms Triggers

Author: Steve Muench, ADF Development Team
Date: January 4, 2010
Revision 1.0 ( Revision History)

Abstract

This paper provides a quick summary of how basic tasks performed using the most common Oracle Forms triggers are accomplished using the Oracle ADF framework. If you have other common Forms triggers that you use frequently, drop me an email and I'll update the paper to include those, too.


Contents


Query Processing
Database Connection
Transaction "Post" Processing (Record Cache)
Error Handling

NOTE:

This document has been superceded by Appendix D ADF Equivalents of Common Oracle Forms Triggers in the developer's guide.


Query Processing

Forms Trigger Usage ADF Equivalent
PRE-QUERY Execute logic before executing a query in a Data Block, typically to setup values for query-by-example criteria in the "example record". Override executeQueryForCollection() on your view object class and write code before calling the super.
ON-COUNT Override default behavior to count the query hits for a Data Block Override getQueryHitCount() in your view object and do something instead of calling the super.
POST-QUERY Execute logic after retrieving each row from the datasource for a data block. Generally instead of using a POST-QUERY style technique to fetch descriptions from other tables based on foreign key values in the current row, in ADF it's more efficient to build a view object that has multiple participating entity objects, joining in all the information you need in the query from the main table, as well as any auxiliary/lookup-value tables. This way, in a single round-trip to the database you get all the information you need. If you still need a per-fetched-row trigger like POST-QUERY, override the createInstanceFromResultSet() method in your view object class.
ON-LOCK Override default behavior to attempt to acquire lock on the current row in the data block. Override the lock() method in your entity object class and do something instead of calling the super.

Database Connection

Forms Trigger Usage ADF Equivalent
POST-LOGON Execute logic after logging onto the Database Override afterConnect() on your custom application module. Since application module instances can stay connected while serving different logical client sessions, probably what you want is to override the prepareSession() which is fired after initial login, as well as after any time the application module is used by a user that was different from the one that used it last time.
PRE-LOGOUT Execute logic before logging off from the Database Override beforeDisconnect() on your custom application module class and write code.

Transaction "Post" Processing (Record Cache)

Forms Trigger Usage ADF Equivalent
PRE-COMMIT Execute code before commencing processing of the changed rows in all data blocks in the transaction. Override commit() method in a custom DBTransactionImpl class and write code before calling the super.

Note:

See this article for an overview of creating and using a custom DBTransaction implementation.

PRE-INSERT Execute code before NEW row in the datablock is INSERTed into the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_INSERT then write code before calling the super.
ON-INSERT Override default processing for INSERTing a NEW row into the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_INSERT then write code instead of calling the super.
POST-INSERT Execute code after NEW row in the datablock is INSERTed into the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_INSERT then write code after calling the super.
PRE-DELETE Execute code before row removed from the datablock is DELETEd from the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_DELETE then write code before calling the super.
ON-DELETE Override default processing for DELETE-ing a row removed from the datablock from the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_DELETE then write code instead of calling the super.
POST-DELETE Execute code after row removed from the datablock is DELETEd from the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_DELETE then write code after calling the super.
PRE-UPDATE Execute code before row changed in the datablock is UPDATEd in the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_UPDATE then write code before calling the super.
ON-UPDATE Override default processing for UPDATE-ing a row changed in the datablock from the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_UPDATE then write code instead of calling the super.
POST-UPDATE Execute code after row changed in the datablock is UPDATEd in the database during "post" processing. Override doDML() method in your entity class and if the operation equals DML_UPDATE then write code after calling the super.
POST-FORMS-COMMIT Execute code after Forms has "posted" all necessary rows to the database, but before issuing the data COMMIT to end the transaction. If you want a single block of code for the whole transaction, you can override the doCommit() method in a custom DBTransactionImpl object and write some code before calling super. To execute entity-specific code before commit for each affected entity in the transaction, override the beforeCommit() method on your entity object and write some code there.
POST-DATABASE-COMMIT Execute code after database transaction has been committed. Override commit() method in a custom DBTransactionImpl class and write code after calling the super.

Error Handling

Forms Trigger Usage ADF Equivalent
ON-ERROR Override default behavior for handling an error. Install a custom error handler ( DCErrorHandler) on the ADF BindingContext

Revision History

Revision Date Comments
1.0 24-May-2005 Created
false ,,,,,,,,,,,,,,,