Dive into Oracle ADF

Send me a mail
 Dive into Oracle ADF   Click to see the XML version of this web page.   (Updated: 2/3/2008; 9:12:13 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:

Search BC4J JavaDoc:

February 2004
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
Jan   Mar

Get Firefox!

Friday, February 27, 2004

In the Oracle field office where I work, my cubicle is next to the cube of a very busy Oracle Consultant who in the past I often have overhead grumbling about the complexity of earlier Oracle application server releases (the OracleAS 9.0.2 release in particular). Now that OracleAS 10g (v9.0.4) is production, and after he got back from vacation this week, yesterday he installed OracleAS 10g 9.0.4 on RedHat Linux and I overhead him telling several of his co-workers:

  • "Did they completely change the development team for the 10g version!?!?"
  • "OracleAS 10g is a completely different product!"
  • "It installed easily, runs much faster, and didn't need to be patched right after installation!"

Since I work mostly with our JDeveloper IDE, I personally work with the standalone OC4J J2EE container for most of my daily development work, but when our consultants go out and work on real customer sites, of course they are typically installing and using the full, enterprise versions of our application server. This was great to hear that our Oracle Application Server team has made such an awesome improvement in ease of installation, performance, and robustness.

Oracle Product Managers for our application server like Steve Button and Mike Lehmann are blogging about it on a pretty regular basis. Might want to check them out.

6:13:40 PM    

Leonardo from Rome writes in to ask: "How can I install an Oracle ADF-based application on IBM WebSphere? How come the ADF Runtime Installer in JDeveloper 10g doesn't have WebSphere as a default choice?"

At the end of the day, the Oracle ADF framework is just some JAR files. Just like the JDBC driver, Struts, or other libraries that you code leverages to focus less on the plumbing and more on your application code.

The ADF Runtime Installer understands the steps necessary to modify the app server configuration files for different app servers in order to install ADF in a single, permanent place to be shared for all ADF-based apps on that server. We don't currently have it programmed to automatically configure WebSphere, but what it's doing is just copying some JAR's and resources for UIX-based apps.

If you:

  1. Take OC4J Standalone from OTN. The OracleAS 10g (v9.0.4)  version.
  2. Run the ADF Installer for standalone oc4j
  3. Review the HTML summary page that it produces at the end

You will have a cookbook for what needs to be setup on any app server to make an ADF-based app work. You can follow those steps with those same JAR's for WebSphere and you should be in business.

That said, it's not the only way to install ADF. Since an ADF application is just a J2EE EAR file, you can also choose to deploy all of the ADF libraries along with your application, too. In that case, you wouldn't need any kind of global ADF installation on the appserver.

6:00:33 PM    

Imagine that you have two view objects AllDepartments and DepartmentsLessThan. Furthermore, assume that your DepartmentsLessThan view object has a WHERE clause of:

deptno < :0

If at runtime you programmatically set the zero-th WHERE clause param on your instance of DepartmentsLessThan to a value like 3...

myDeptsLessThan.setWhereClauseParam(0, new Number(3));

then of course, if you re-execute the query you will only retrieve departments whose Deptno attribute value is less than 3.

The reason that you would turn on the view link consistency flag for a view object instance is that you want NEW rows created through any other (in this case) Dept-entity-based view object to automatically show up in rowsets based on that view link consistent view object instance. In this case, if we call setAssociationConsistent(true) on the myDeptsLessThan VO instance, it would mean that a Dept-entity-based row inserted into a rowset based on the Departments view object would automatically show up in any rowsets based on the DepartmentsLessThan view object, too.

If you insert a department with Deptno 4 into the Departments view, since you've set the bind variable on DepartmentsLessThan to the value of 3, you might reasonably expect that this new department row would NOT show up in this restricted view, since a Deptno value of 4 is not less than 3. However, in practice you need to understand that BC4J does not have an in-memory SQL predicate evaluation engine running to try and duplicate the filtering prowess of the database. So, to achieve this desired behavior, we need a little help from you, the programmer.

We provide you with the ViewObjectImpl method:

protected boolean rowQualifies(ViewRowImpl vr)

Which you can override to give us the additional application-specific knowledge that we need to properly filter in Java in the same logical way that your (potentially very complicated!) SQL WHERE clause implements.

   * Return false for new rows that are candidates to be added
   * to a rowset based on this view object if their Deptno value
   * is not less than the current value of the bind variable
   * from this view object's WHERE clause of:
   *    WHERE deptno < :0
   * Assume that rows that are not status NEW qualify since they will
   * have been queried from the database.
  protected boolean rowQualifies(ViewRowImpl vr) {
    if (vr.getEntity(0).getPostState() == Entity.STATUS_NEW) {
      Number bindVar = (Number)vr.getQueryCollection(null).getRowFilter().getParamValues()[0];
      Number deptNo = (Number)vr.getAttribute("Deptno");
      return deptNo != null && deptNo.compareTo(bindVar) < 0;
    else {
      return true;

This way, your view object with view link consistency on will not inadvertently have added to it rows that don't qualify for its where clause.

2:35:43 PM    

© Copyright 2008 Steve Muench.