Wednesday 29 August 2007

JDeveloper documented "Recommendations"

I've been sitting on this post for a long time, 4 months in fact, as a back up post in case I'm too busy to write anything new. The next few weeks are such a time and it's about time I published this post before the imminent release of JDeveloper 11g Gold! (not that I know anything, but I'd be placing my bets on a November release date)

Oracle's JDeveloper team has to be commended for the large leap in the quality and breadth of documentation from the 10.1.2 to 10.1.3 releases, with the introduction of the ADF Developers' guides. In my opinion the effect of this has been noticeable on the JDev OTN forum where beginner questions have become thinner on the ground, possibly thanks to RTFM.

Of course now with so much documentation -- one such guide is over 1000 pages -- there is an awful lot to digest. Unfortunately within such a large set of documentation, Oracle's "JDeveloper Recommendations" and best practices can be lost or forgotten.

I recently took time out to search within Oracle's JDeveloper 10g provided documentation for any JDeveloper and ADF BC/Faces recommendations that they thought necessary to document. I provide a summary of the recommendations below to assist your JDeveloper experience, may it be a good one ;)

The mileage you experience from each recommendation may vary. Some are trivial, others encompass the whole development cycle.

Disclaimer: please note this is not a definitive list of recommendations, just my own summary. You should persist in regularly reading white papers, blogs and attending Oracle related conferences to keep up with the latest recommendations. If I've missed any of the recommendations you think crucial in the JDev documentation, let me know via a comment with appropriate links, and I'll update this blog. Also take time out to read the original quote in context of the actual JDev documentation by following the links.

Copyright disclaimer: the following quotes are all sourced from Oracle's own documentation and as such please respect their copyright if you source this page and acknowledge their efforts appropriately if you reference a section.

Final comment and appreciation: Thanks to Victoria Lira for her assistance in getting this post finally published.

JDeveloper recommendations
....(from the Oracle documentation set)

JDeveloper migration

Migrating Projects from Pre-Oracle9i Releases - Direct migration from pre-Oracle9i releases to Oracle JDeveloper 10g is not certified. We recommend that you first migrate to release 9.0.x (see the 9.0.x documentation), and then proceed from there.

Migrating System Settings to Oracle JDeveloper 10g - Select the settings and customizations you want to migrate. We recommend selecting all available options.

Projects

Working with Large Projects - It is strongly recommend to use ANT for such tasks as building and deploying.

ADF Business Components

Introducing Oracle ADF Business Components - In addition, if you are an Oracle Forms user, we recommend reading the following topic: About Oracle ADF Business Components: An Oracle Forms Developer's Perspective

Working with ADF Business Components in the Model Project - If you are comfortable with UML modelling, we recommend selecting Business Components Diagram, which provides a graphical interface for designing your business components. You can drag tables onto this diagram to create business domain components. For more information, see the Related Topics list.

ADF BC Application Modules

Accessing a Root - Level Application Module From an Entity Object - You can access a root-level application module directly from an entity object if the entity object is hosted by the application module. Generally speaking, this is not the recommend approach, as your entity object will only work with that particular application module. You might want to do this, for example, if you need to create rows of a view and insert new records in an entity object's doDML() method.

Creating a Package of Data Model Components - We recommend using packages to separate your data model components (view objects, view links, and application modules) from your business domain components (entity objects, associations, and domains). This allows you to reuse your business domain components with multiple sets of data model components. For more information, see the related topics list.

About Oracle ADF Business Components Packages - We recommend putting business domain components (entity objects and associations) in a separate package from data model components (view objects, view links, and application modules). This allows you to reuse your business domain components with multiple sets of data model components.

ADF BC View Objects

Understanding the Default View Link Consistency Setting and How to Change It
- Conversely, you could globally enable this feature by setting jbo.viewlink.consistent to the value true, but Oracle does not recommend doing this. Doing so would force view link consistency to be set on for view objects with secondary entity usages that are not marked as a reference which presently do not support the view link consistency feature well.

Efficiently Scrolling Through Large Result Sets Using Range Paging - As a general rule, for highest performance, Oracle recommends building your application in a way that avoids giving the end-user the opportunity to scroll through very large query results. To enforce this recommendation, call the getEstimatedRowCount() method on a view object to determine how many rows would be returned the user's query before actually executing the query and allowing the user to proceed. If the estimated row count is unreasonably large, your application can demand that the end-user provide additional search criteria.

Consider Whether Fetching One Row at a Time is Appropriate - Caution - Unless your query really fetches just one row, leaving the default fetch size of one (1) in the in Batches of field on the Tuning panel is a recipe for bad performance due to many unnecessary round trips between the application server and the database. Oracle strongly recommends considering the appropriate value for each view object's fetch size.

How a RowMatch Affects Rows Fetched from the Database - Oracle recommends using database-level filtering to retrieve the smallest-possible rowset first, and then using RowMatch as appropriate to subset that list in memory

Creating a Calculated Attribute at the View Object Level - Ensure View Row Class > Generate Java File and Generate Accessors are selected. We recommend selecting Ex pose Accessors to the Client as well.

Adding a View Link Instance with a New View Object Attribute - Based Definition at Runtime - Note: This is the most flexible, but the most complex, way to create view link instances dynamically. If you have a view link definition or association that might be appropriate, we recommend that you use another method. For more information, see the related topics list.

Using Parameterized WHERE Clauses - In the Where field, enter a WHERE clause using parameters. Do not include the word "WHERE". Unless you are running against a non-Oracle database, we suggest you use Oracle-style parameters: ORDER_TOTAL > :1 + :2

ADF BC Runtime Properties

Oracle ADF Business Components System Properties # 1 - jbo.locking.mode - Note: In the case of session-oriented programs, such as web applications, it is recommended that the Oracle ADF Business Components property jbo.locking.mode should be set to optimistic unless you also set the RELEASE_MODE property to Reserved. Pessimistic locking is not compatible with Stateful or Stateless modes because the database transaction is always rolled back to allow the connection to be reused by another user. This results in the lock being released and makes pessimistic locking unusable. If you want to use pessimistic locking, you must set RELEASE_MODE to Reserved.

* and *

jbo.maxpoolcookieage - The maximum age of the browser cookies used to help clients retrieve stateful application modules. If these cookies do not time out, the value is -1. It is recommended that the max cookie age is always set less than or equal to the session cookie age. It is set that way by default (both are -1). If you change the the max cookie age then you must also change the session cookie age to the same value.

ADF BC Java stack

oracle.jbo.server.EntityCacheOverRowSet jdoc - getRow - use instead findByKey() for larger datasets

Note this discussion is repeated in:

oracle.jbo.common.ws.WSObject
oracle.jbo.client.remote.ViewUsageImpl
oracle.jbo.RowIterator
oracle.adf.model.generic.DCRowSetIteratorImpl

oracle.jbo.CSMessageBundle - In general, we recommend using EXC_INVALID_PARAMETER instead of EXC_INVALID_PARAM_NO_EXPL_GIVEN.

ADF Faces

The ADF Faces Dialog Framework - Note that we've also set "partialSubmit" on the commandButton to "true"; we highly recommend using this option on buttons that launch dialogs, as it avoids an otherwise unnecessary flash of the main page as the dialog is launched.

Configuring ADF Faces for Performance - In adf-faces-config.xml.....

When configuring ADF Faces for deployment, it is most critical that debug options have been turned off. Specifically: < debug-output > should be removed or set to false. oracle.adf.view.faces.CHECK_FILE_MODIFICATION should be removed or set to false. oracle.adf.view.faces.DEBUG_JAVASCRIPT should be removed or set to false.

* and *

The < c:if > will show "You're in an English locale" if the locale's language is English. This means that in English, a user's version of the page will have an extra component over users who aren't using English; the state will vary accordingly. This sort of problem can cleanly be resolved by using "rendered" instead of < c:if > , which is always a recommended JSF best-practice:

ADF Faces Page Definitions

What You May Need to Know About Binding to Values in Other Pages - While Oracle does not recommend this approach, you can access the bound values in another page's binding container from the current page using the data binding variable in an EL expression. The data binding variable references the binding context itself, which provides access to all the binding containers that are available. Use this variable when you want to bind to an object in the binding container of another page. The data variable must be immediately followed by the name of a page definition file that defines the binding container being referenced. For example: #{data.mypagePageDef.BindingObject.propertyName}

*and*

You may find cases, where you need to use the data variable to bind to values across binding containers. However, Oracle recommends that instead you use a backing bean to store page values and make them available to other pages. For more information about storing values in backing beans, see Using a Managed Bean to Store Information.

ADF Faces Components

<af:subform>
+ oracle.adf.view.faces.component.core.CoreSubForm

We strongly recommend the use of a single < af:form > per page, and using < af:subform > where you might otherwise be tempted to use multiple forms. Multiple forms require multiple copies of page state, and user edits in forms that aren't submitted are always lost. When a page using subforms is submitted, page state is only written once, and all user edits are preserved

ADF Faces Support Platforms

About ADF Faces Supported Platforms - Tip: On a UNIX server box, button images may not render as expected. Assuming you're using JDK 1.4 or later, we strongly recommend using -Djava.awt.headless=true as a command-line option with UNIX boxes.

CVS

About CVS and JDeveloper - We strongly recommend that you read the CVS Manual ("Version Management with CVS" by Per Cederqvist et al), which is freely available from www.cvshome.org

Note. Even if you know how to use existing checked out modules with JDeveloper CVS version control, you should not do so. We strongly recommend that you instead perform fresh checkouts from within JDeveloper.

Configuring JDeveloper for CVS - If you wish to use an external CVS client, we recommend the following: CVSNT 2.0.58a for Windows platforms - http://www.cvsnt.org/archive cvshome's CVS 1.11.9 for other platforms

No comments: