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:16:57 PM.)
Tips and tricks from Steve Muench on Oracle ADF Framework and JDeveloper IDE

Search blog with Google:
 

Search BC4J JavaDoc:
 

May 2005
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
29 30 31        
Apr   Jun

Get Firefox!

Thursday, May 12, 2005

I have been in email contact over the last week with a customer who followed my detailed, step-by-step Building J2EE Application with Oracle JHeadstart for ADF tutorial. His feedback was that when he tried JHeadstart on a couple of his real-world tables, drilling down from master to detail just hung and never showed the page. Wanting to get to the bottom of the issue, I used our handy Oracle Web Conferencing software to let him show me what was happening. Even better, he granted me remote control of his machine so I could "drive" JDeveloper and check out a few things myself (while he sat back and watched in front of his own PC).All I can say is that I sure wish we had software like Oracle Web Conference back in 1990 when I worked in Oracle Tech Support!

We were able to figure out what was causing the web browser to apparently hang when drilling down to the details. First, a little background. The customer's data model was basic master/detail like classic DEPT and EMP tables, except that in their case, there were 600,000+ "departments" and millions of "employees". Of course, their tables also had more columns, but nothing fancy: a mix of NUMBER, DATE, and VARCHAR types. Like the EMP table, their "detail" table had a self-referencing relationship so that one "detail" could refer to another related detail row via a foreign key. Just like how an EMP row has a MGR field that points to the empno of another manager.

When JHeadstart generated a master/detail set of pages for the customer's data, as it always does when creating a default application structure, it "sniffed" out the associations between the entity objects and created lookups for them. The one of interest was the self-join lookup, so that the end-user can easily pick which employee is their manager from a list of all employees.

The rub lied in the combination of the sheer number of "EMP" rows their data model had (over a million!) and the fact that by default, JHeadstart setup up the lookup to have a displayType of choice. The lookup style of choice renders in the browser as a drop-down list, and like any drop-down list you are familiar with in any web form you've ever filled out, the drop-down list contains the complete list of valid choices to pick from. In this case, the complete list had over a million rows in it, so when ADF UIX was rendering the detail page, that was causing the underlying ADF View Object for the employee lookup to try and fetch all million rows. Had there been enough time and memory to accomplish that, the next "issue" would have been in the sheer bulk of HTML tags that would need to get rendered to the browser to show such a long drop-down list. This would further be complicated by the fact that the display was showing 10 rows in a table, so hypothetically-speaking that HTML page -- effortlessly rendered by ADF UIX's <messageChoice> control -- would be sending ten times a million+ choices down to the browser to render the 10 occurrences of that "employees lookup".

The executive summary was that this is a great example of when a Lookup should be switched to use the LOV style of display instead of the choice style. The LOV style of lookup doesn't query up all the rows for the valid choice, and can be further optimized by unsetting the "Auto-Query" property in the lookup and setting a maximum search hits of some reasonable number for the LOV in the JHeadstart application structure editor.


2:15:18 PM    



I read the Domain Objects as Data Transfer Objects? blog posting today and agree with the guy that that there is a real need to have your client-facing data "shaped" differently from your business domain model. I've also wondered about the problems he describes like the "Unusable methods" problem and the notion that "business logic gets implemented in procedural code located outside the domain layer" when trying to make your domain objects do double-duty as your data transfer objects. I guess the development community will let everyone know the approaches that end up working out best in practice, but my gut feeling is that this guy's article is right about the important role the data transfer objects play, now and in the future.

This is the fundamental separation that ADF view object's and ADF entity objects offer. The view objects project, shape, and filter data to send the minimal amount of the data in exactly the shape a client will need it. They also provide you with the appropriately-shaped data transfer objects to match your query results that clients will see. ADF entity objects handle encapsulating the domain data and business logic inside a simple class that is not trying to do double-duty as a data transfer class and a domain business logic class. In fact, by design ADF entity objects are not directly accessible to clients. This page summarizes the various J2EE Design Patterns that the ADF framework implements for you.


9:34:57 AM    


© Copyright 2008 Steve Muench.