Oracle JDeveloper Tip

Coding Tips for ADF Business Components

Author: Steve Muench, ADF Development Team
Date: August 12, 2004


This article is valid for ADF Business Components in JDeveloper 10g and beyond, as well as for Business Components for Java (BC4J) in JDeveloper 9.0.4 and earlier.


The commented class in the example workspace provided here shows various ADF Business Components programming techniques. It's a simple console program that prints messages out to standard out. It is probably most useful to follow the code in the debugger step by step.

Some of the features that it illustrates are:

  • Executing commands with Transaction.executeCommand()
  • Setting where and order by clauses on view objects
  • Setting where clause parameter values
  • Estimating the number of rows a view object's query will retrieve
  • Setting query optimizer hints at runtime on a view object
  • Limiting the number of rows retrieved on a view object by setting max fetch size
  • Executing view object queries and iterating through the results of their default rowset
  • Resetting a view object's default iterator to re-loop through the rows another time
  • Setting up View Criteria collection of View Criteria Rows and applying the criteria
  • Clearing the View Criteria
  • Finding a row in a view object with findByKey()
  • Marshalling a single row of a view object into XML with customized list of attributes to include
  • Creating new rows in a view object
  • Highlighting the built-in reference mechanism of join view objects to pull in foreign key related information when the value of the foreign key attribute changes in a row
  • Reading a row of information from an XML document
  • Adding a dynamic attribute at runtime to track "selected" rows
  • Introspecting the runtime metadata of a view object
  • Conditionally turning on SQL_TRACE to capture SQL statement into a TKPROF-analyzable trace file on the server
  • Creating a view object at runtime based on a SQL statement
  • Illustrating the effect of calling postChanges() or not during a transaction
  • Removing a row from a view object
  • Registering warnings from entity object business logic
  • Using a custom exception and warning handler (one in English, and one in Italian)
  • Using custom exceptions
  • Invoking custom application module methods from client code through the application module custom interface after exposing the methods as client-accessible
  • Returning arrays of Rows from a custom method

Installation Instructions

  1. Download
  2. Define a connection named hr in JDeveloper that points to the HR demo schema that ships with the database
  3. Open Techniques.jws workspace, acknowledging any migration dialogs that might appear.
  4. Run or debug in the Techniques.jpr project
false ,,,,,,,,,,,,,,,