ADF Best Practices
ADF Best Practices
Target Audience
This document will be a helpful reference point for ADF developers,
ADF Tech Leads and ADF Solution architects. This document
assumes a good understanding of ADF and a conceptual know-how
of J2EE framework.
Overview
Entity Objects
Define at least one entity object key attribute per entity object
- An entity object must has at least one attribute defined as the
key.
Do not access an application module from an entity object entity objects should not access application modules as this
makes the entity object only useable within that application
module.
Don't use ROWID as entity object key - By default if ADF BC
doesn't find a primary key at design time for an entity object's
related database table, it will generate an additional attribute
mapping to ROWID. This will continue to work unless an Oracle
database Real Application Cluster(RAC) is used where across
database partitions different ROWIDs can be returned for the
same row.
Define entity object attribute labels for UI displayed
attributes - For all entity object attributes that are displayed in the
UI set their default label.
View Objects
Never use view object select * - Never use SELECT * for a view
object query. Always specify all columns in the query.
Avoid hardcoding view object queries with literals - Don't
hardcode view object where clauses or view criteria with literals.
Always use bind variables.
Use view object bind variables over dynamic SQL - Bind
variables also make the queries of view objects less susceptible to
SQL injection attacks.
Don't define circular list of value dependencies - View objects
allow you to define dependent/chained list of values. Be careful
not to define a circular dependency as this can result in an infinite
loop.
Ensure view object UI Hints and messages internationalized Assuming that the application will be translated all view object
field labels and other relevant UI hints and messages need to be
managed via message bundles.
Application Module
Pages
JavaScript
Avoid inlineStyle and contentStyle CSS added to a page CSS added directly in a page is not compressed, it makes the
page harder to manage and maintain, and increases the page
download size. Use inlineStyle and contentStyle properties for
dynamic color coding only and have the properties referencing a
managed bean property to return the CSS string
Do not use percentage height styles - Heights expressed as a
percentage are not reliable and behavior differs between
browsers. Use absolute values for height if height must be
specified at all
Bindings
Taskflows
Beans
Define applicationScope and sessionScope beans in adfcconfig.xml - applicationScope and sessionScope managed
beans should be defined in the adfc-config.xml file.
Define unbounded task flow beans in adfc-config.xml - For
any page or page fragment used by an application's unbounded
task flow, any relating bean used by the page should also be
defined in the adfc-config.xml.
Define bounded task flow bean in their own .xml file - For any
page or page fragment used by a bounded task flow, any relating
managed bean used by the page should also be defined in the
bounded task flow's .xml file.
Avoid business logic in bean methods - complex business logic
that manipulates model layer data should not be placed in the
ViewController layer. Consider placing such code in the model
layer instead and making one programmatic call from the bean.
Variables in applicationScope and sessionScope beans - Be
mindful of the variables you store in applicationScope and
sessionScope as they may be stored there for longer than
necessary.
web.xml
Consider setting
oracle.adf.view.rich.security.FRAME_BUSTING for production
consider the web.xml
oracle.adf.view.rich.security.FRAME_BUSTING context
parameters options to prevent clickjacking, which occurs when a
malicious web site pulls a page originating from another domain
into a frame and overlays it with a counterfeit page.
Consider oracle.adf.view.rich.versionString.HIDDEN=false for
production set the web.xml
oracle.adf.view.rich.versionString.HIDDEN context parameter to
true to remove the ADF Faces version information on each page
to reduce the size of the page and also remove an attack vector
by unnecessarily publishing the version of ADF.
weblogic.xml
Deployment
References
1) Oracle ADF Technical overview:
http://www.oracle.com/technetwork/developertools/adf/adf-11-overview-1-129504.pdf
2) Oracle ADF Web Developers Guide 11.1.2.1.0
http://docs.oracle.com/cd/E24382_01/web.1112/e1618
1.pdf
3) Oracle ADF Fusion Developer's Guide 11.1.2.1.0
http://docs.oracle.com/cd/E29049_01/web.1112/e1618
2.pdf